NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.
Forum Discussion
Chortle
Aug 09, 2014Aspirant
How to install SQL and PHP on the ReadyNAS Duo v2
I was looking to setup an 'intranet' of sorts on a home network to have an accessible Word Press blog simply to store addresses of family, important dates and a few other bits and pieces. It took me ages to work out but once it worked I've used it daily. A must have for anyone like me looking for more ways of becoming increasingly redundant!
NOTE: Every firmware update you receive irritatingly removes support for PHP so if you discover PHP starts downloading rather than executing you may have to edit the httpd.conf file again as described in Step 4.
STEP 1: Install Root SSH Access
STEP 2: Install PHP/SQL packages
- enter "ssh root@[YOUR NAS]" and login
- next type "sudo apt-get install libapache2-mod-php5 php5-mysql mysql-server"
- Hit return and wait for it to install relevant packages
STEP 3: Setup SQL
- Type "sudo mysql" and hit return to run SQL
- Make sure you replace the <username> with a username and <42-digit password> with a 42 digit password "CREATE USER '<username>'@'localhost' IDENTIFIED BY '<42-digit password>';" then hit return.
- Next type "FLUSH PRIVILEGES" and hit return followed by "exit"
STEP 4: Edit your httpd.conf file
- Make sure your logged out of the NAS (ie type exit or open a new terminal window)
- type "sftp root@[YOURNAS]" and login
- next type "cd /etc/frontview/apache" and hit return
- next type "lcd /User/[YOUR USERNAME]/Desktop" and hit enter (the file will end up on your desktop but you can move it where you like).
- next type "mget httpd.conf"
- IMPORTANT: BACK UP YOUR HTTP.CONF FILE TO AVOID SCREWING YOUR NAS UP
- Open your httpd.conf file and find:
- Replace with the following:
- Then find the following code:
- Replace with the following:
STEP 5: Upload the modified httpd.conf
- Make sure your logged out of the NAS (ie type exit or open a new terminal window)
- type "sftp root@[YOUR NAS]" and login
- type "cd /etc/frontview/apache" and hit return
- type "lcd /Users/[YOUR USERNAME/Desktop" and hit return
- type "rm httpd.conf" then "mput httpd.conf" (make sure you have a backup ok?)
STEP 6: Restart Apache
- You can either restart the NAS or use the following terminal commands
- Make sure your logged out of the NAS and then Login using SSH (not SFTP)
- type "killall apache-ssl" and hit return
- type "apache-ssl -f /etc/frontview/apache/httpd.conf" and hit return
OTHER HINTS: Setting up a Share for Browser Access
- Create a new 'share'; I made one called "www".
- In the NAS admin go to admin panel>configure>shares
- Click the + button and create a new share
- Click on the share in the window and make sure 'http' is ticked on the right hand side under sharing protocols
- Click refresh symbol button found on the actual page (not the browser window!)
- To Enable http access (go to admin panel>configure and click the HTTP button) and select your share on the drop down labeled "Redirect default web access to this share". Hit apply.
...And now I can access PHP files from http://[MY-NAS-IP]/www/
TROUBLESHOOTING: PHP.INI
I had an issue my with my php.ini file which required the following action to be taken:
- Make sure your logged out of the NAS (ie type exit or open a new terminal window)
- type "sftp root@[YOUR NAS]" and login
- type "cd /etc/php5/apache2" and hit return
- type "lcd /Users/[YOUR USER]/Desktop" and hit return
- type "mget php.ini"
- IMPORTANT: Back up your php.ini file incase anything goes wrong
- Then open your php file and look for:
- Remove the ; at the beginning of the line so it looks looks like:
- Upload the modified php.ini file
- type "sftp root@[YOUR NAS]" and login
- type "cd /etc/php5/apache2" and hit return
- type "lcd /Users/[YOUR USER]/Desktop" and hit return
- type "rm php.ini" and then "mput php.ini"
- Note: You may need to restart apache again as described in step 6 for this to have any affect.
I hope this helps folks looking for a few hints! It was a pain in the proverbial to get it sorted first time but now it works perfectly for me :neener:
NOTE: Every firmware update you receive irritatingly removes support for PHP so if you discover PHP starts downloading rather than executing you may have to edit the httpd.conf file again as described in Step 4.
STEP 1: Install Root SSH Access
STEP 2: Install PHP/SQL packages
- enter "ssh root@[YOUR NAS]" and login
- next type "sudo apt-get install libapache2-mod-php5 php5-mysql mysql-server"
- Hit return and wait for it to install relevant packages
STEP 3: Setup SQL
- Type "sudo mysql" and hit return to run SQL
- Make sure you replace the <username> with a username and <42-digit password> with a 42 digit password "CREATE USER '<username>'@'localhost' IDENTIFIED BY '<42-digit password>';" then hit return.
- Next type "FLUSH PRIVILEGES" and hit return followed by "exit"
STEP 4: Edit your httpd.conf file
- Make sure your logged out of the NAS (ie type exit or open a new terminal window)
- type "sftp root@[YOURNAS]" and login
- next type "cd /etc/frontview/apache" and hit return
- next type "lcd /User/[YOUR USERNAME]/Desktop" and hit enter (the file will end up on your desktop but you can move it where you like).
- next type "mget httpd.conf"
- IMPORTANT: BACK UP YOUR HTTP.CONF FILE TO AVOID SCREWING YOUR NAS UP
- Open your httpd.conf file and find:
LoadModule addonhandler_module /frontview/lib/mod_addonhandler.so
- Replace with the following:
LoadModule addonhandler_module /frontview/lib/mod_addonhandler.so
LoadModule php5_module /usr/lib/apache2/modules/libphp5.so
AddType application/x-httpd-php .php
PHPIniDir /etc/php5/apache2
- Then find the following code:
DirectoryIndex redirect.html index.html index.htm
- Replace with the following:
DirectoryIndex redirect.html index.html index.htm index.php
STEP 5: Upload the modified httpd.conf
- Make sure your logged out of the NAS (ie type exit or open a new terminal window)
- type "sftp root@[YOUR NAS]" and login
- type "cd /etc/frontview/apache" and hit return
- type "lcd /Users/[YOUR USERNAME/Desktop" and hit return
- type "rm httpd.conf" then "mput httpd.conf" (make sure you have a backup ok?)
STEP 6: Restart Apache
- You can either restart the NAS or use the following terminal commands
- Make sure your logged out of the NAS and then Login using SSH (not SFTP)
- type "killall apache-ssl" and hit return
- type "apache-ssl -f /etc/frontview/apache/httpd.conf" and hit return
OTHER HINTS: Setting up a Share for Browser Access
- Create a new 'share'; I made one called "www".
- In the NAS admin go to admin panel>configure>shares
- Click the + button and create a new share
- Click on the share in the window and make sure 'http' is ticked on the right hand side under sharing protocols
- Click refresh symbol button found on the actual page (not the browser window!)
- To Enable http access (go to admin panel>configure and click the HTTP button) and select your share on the drop down labeled "Redirect default web access to this share". Hit apply.
...And now I can access PHP files from http://[MY-NAS-IP]/www/
TROUBLESHOOTING: PHP.INI
I had an issue my with my php.ini file which required the following action to be taken:
- Make sure your logged out of the NAS (ie type exit or open a new terminal window)
- type "sftp root@[YOUR NAS]" and login
- type "cd /etc/php5/apache2" and hit return
- type "lcd /Users/[YOUR USER]/Desktop" and hit return
- type "mget php.ini"
- IMPORTANT: Back up your php.ini file incase anything goes wrong
- Then open your php file and look for:
; mysqli.allow_local_infile = On
- Remove the ; at the beginning of the line so it looks looks like:
mysqli.allow_local_infile = On
- Upload the modified php.ini file
- type "sftp root@[YOUR NAS]" and login
- type "cd /etc/php5/apache2" and hit return
- type "lcd /Users/[YOUR USER]/Desktop" and hit return
- type "rm php.ini" and then "mput php.ini"
- Note: You may need to restart apache again as described in step 6 for this to have any affect.
I hope this helps folks looking for a few hints! It was a pain in the proverbial to get it sorted first time but now it works perfectly for me :neener:
1 Reply
Replies have been turned off for this discussion
- SmashweldAspirantHello
By step 2, which sql-version do you download?
Best regards / Håkan F
Related Content
NETGEAR Academy
Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology!
Join Us!