Installing PHP5 on Readynas Duo v2 (should work on all ARM)

Please post any helpful and useful tips to maximize your fellow ReadyNAS users' experience.

Installing PHP5 on Readynas Duo v2 (should work on all ARM)

Postby kraeks » Wed May 30, 2012 8:07 am

Since i'm not a big fan for paying for things that are easily done by myself, I thought
i'd take the time to write down how i went about to install and configure PHP5, MySQL and phpMyAdmin
on the ReadyNAS Duo v2. (pun partially intended, although readynasxtras provide a whole set of other
packages as opt in the payed add-on...)

This assumes you've already got EnableRootAccess up and running.

1. Installing and configuring PHP5.

First off, we need to install the PHP5-package with apt-get. Log in to your NAS via SSH to get started.
As the security aware users we are (;-)) the root account is ofc disabled for login, so we'll have to
do these operations as sudoers instead. Type:

Code: Select all
sudo apt-get install libapache2-mod-php5 php5-cli php5-common php5-cgi


Some of the packages will probably be marked as installed or set to manually. This is natural so just
type Y and sit back while the packages is being installed.

After this we have to add the php5_module and trigger php-files to be handled by the php5-module.
Type:

Code: Select all
sudo /etc/frontview/apache2/httpd.conf


Then find the lines loading modules, for ex. :

Code: Select all
LoadModule perl_module /usr/lib/apache2/modules/mod_perl.so


Append these lines to this section in the file:

Code: Select all
LoadModule php5_module /usr/lib/apache2/modules/libphp5.so
AddHandler php5-script .php


Now find this line:

Code: Select all
DirectoryIndex redirect.html index.html index.htm


and change it to:

Code: Select all
DirectoryIndex redirect.html index.html index.htm index.php


Now we need to restart apache by typing:

Code: Select all
sudo killall apache-ssl
sudo apache-ssl -f /etc/frontview/apache/httpd.conf


You should now be able to use PHP on your ReadyNAS!

I'm going to write an instruction for how to install and configure MySQL and phpMyAdmin as well in the
upcoming posts but since I have to leave now this will have to do for the time being.

Cheers,
Simon
User avatar
kraeks
ReadyNAS Newbie
 
Posts: 12
Joined: Wed May 30, 2012 7:46 am
Location: Sweden
ReadyNAS: Duo v2

Re: Installing PHP5 on Readynas Duo v2 (should work on all A

Postby kraeks » Wed May 30, 2012 1:34 pm

Now we're going to install MySQL and phpMyAdmin

2. Installing and configuring MySQL

This is a pretty straight forward process. Start by installing the package with apt-get:

Code: Select all
sudo apt-get install mysql-server


Then proceed into the MySQL console by typing:

Code: Select all
sudo mysql


Now create a user (or as many as you need) with this command:

Code: Select all
CREATE USER '<username>'@'localhost' IDENTIFIED BY '<42-digit password>';


When you've created all the users you need, proceed with the following:

Code: Select all
FLUSH PRIVILEGES;
exit


Write down your freshly created password and store it in a secure location.
For example in a file in /root. A note in your drawer isn't a very good option.

You don't have to create a database at this point since this will be very easily done from phpMyAdmin.

2. Installing and configuring phpMyAdmin

Go to your www-root and download the latest phpMyAdmin version with wget using the URL found here:
Code: Select all
http://www.phpmyadmin.net/home_page/downloads.php


In this example we will be using tar.gz.
Extract the file using the following command:

Code: Select all
sudo tar xvzf <filename>


Now change the name of phpMyAdmin into something a little easier to write, for example phpadm by typing the following:

Code: Select all
sudo mv <dirname> phpadm


Now you should be able to access phpMyAdmin from your external url followed by /phpadm.
Use the username and password created in MySQL to log in.
Last edited by kraeks on Thu Jun 14, 2012 4:16 am, edited 1 time in total.
User avatar
kraeks
ReadyNAS Newbie
 
Posts: 12
Joined: Wed May 30, 2012 7:46 am
Location: Sweden
ReadyNAS: Duo v2

Re: Installing PHP5 on Readynas Duo v2 (should work on all A

Postby tomvdB » Wed Jun 13, 2012 3:07 pm

hello,

when i try to download/install MySQL and use

sudo apt-get install mysql

i get this response:

Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package mysql

what could i be doing wrong?

Please help, i would really like to use MySQL.

kind regards,

Tom
tomvdB
ReadyNAS Newbie
 
Posts: 1
Joined: Wed Jun 13, 2012 3:03 pm
ReadyNAS: Duo v2

Re: Installing PHP5 on Readynas Duo v2 (should work on all A

Postby kraeks » Thu Jun 14, 2012 4:15 am

Sorry. I'll update the guide. The package name is mysql-server, not just mysql. :-)
User avatar
kraeks
ReadyNAS Newbie
 
Posts: 12
Joined: Wed May 30, 2012 7:46 am
Location: Sweden
ReadyNAS: Duo v2

Re: Installing PHP5 on Readynas Duo v2 (should work on all A

Postby iearmand » Tue Jul 17, 2012 3:26 am

Can I ask a complete newbie question..but when you say "Go to your www-root and download the latest phpMyAdmin"
What do you mean by www-root...I cant find this anywhere and setting up a http service does not seem to help matters.

Also you may wish to correct the line of code below from:

Code: Select all
sudo apt-get install mysq-serverl


to

Code: Select all
sudo apt-get install mysql-server
iearmand
ReadyNAS Newbie
 
Posts: 16
Joined: Mon Jan 09, 2012 6:18 am

Re: Installing PHP5 on Readynas Duo v2 (should work on all A

Postby iearmand » Tue Jul 17, 2012 6:26 am

This post helped greatly with getting everything installed and working.

viewtopic.php?f=11&t=63434
iearmand
ReadyNAS Newbie
 
Posts: 16
Joined: Mon Jan 09, 2012 6:18 am


Return to User Submitted Tips



Who is online

Users browsing this forum: No registered users and 1 guest