LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Installation of PHP 5.1.4 and MySQL 5.0.21 (http://www.linuxquestions.org/questions/linux-software-2/installation-of-php-5-1-4-and-mysql-5-0-21-a-443074/)

anjanesh 05-09-2006 06:43 AM

Installation of PHP 5.1.4 and MySQL 5.0.21
 
Hi

I got a Virtual Dedicated Server without a control panel. I want to PHP 5.1.4 and MySQL 5.0.21 on the server.

How do go abt installing these ?

Thanks

btmiller 05-09-2006 11:01 PM

Looks like they run Fedora Core 2, which is a bit out of date, but oh well. I'd suggest going to www.php.net and www.mysql.com and trying to find an RPM of those versions that will work with your system. If you can live with the older versions that shipped with FC2 then yuou can easily grab an RPM from any fedora mirror or configure yum to install the software. There are plenty of sites on the net that explain how to install software via rpm and automate the process using yum.

anjanesh 05-10-2006 12:25 AM

I dont think its possible to install FC5 on a virtual dedicated server, is it ?
Wont the latest RPM versions of PHP and MySQL install on FC2 ?

Basel 05-17-2006 04:55 AM

I would appreciate it if you could share your experience with installing PHP5 and MySQL5 under your VDS. I'm currently searching the Internet for an answer sincce I am planning to get a VDS with GoDaddy. I might even install FC2 at home and try it out for myself.

anjanesh 05-17-2006 05:25 AM

Everything has to be done via SSH as theres no control panel. Actually, if a control panel was there it would be a headache because we can customize it according to our own needs.

I still havent got the latest versions of PHP and MySQL installed - but I read that using the RPMs or unzipping and making is pretty much it and examples are all over the net - I just didnt take the time to get this done.

If you get it done pl let me know the steps.

Basel 05-17-2006 05:33 AM

Thanks anjanesh,

What about the Simple Control Panel, Plesk 30-domain control panel, and the cPanel unlimited control panel?
Okay, I will let you know if I manage to get them installed.

EDIT: It worked :)
First, I did a basic installation of FC2 and then downloaded php-5.1.3.tar.bz2, httpd-2.2.0.tar.bz2 and mysql-standard-5.0.21-linux-i686-glibc23.tar.gz.
Second, I followed the instructions in mysql-standard-5.0.21-linux-i686-glibc23/INSTALL-BINARY to get MySQL up and running. I had to run 'su - root' since the addgroup command was not available when I used 'su'.
Third, to install Apache I followed the 'Apache 2.0 on Unix systems' section in php-5.1.3/INSTALL.
Fourth, I downloaded libxml2-2.6.16-2.i386.rpm, libxml2-devel-2.6.16-2.i386.rpm and libxml2-python-2.6.16-2.i386.rpm from http://download.fedora.redhat.com/pu...pdates/2/i386/. PHP5 needs at least version 2.6.11 of libxml2 to configure so I had to update the three packages using 'rpm -Uhv libxml2*.rpm' as root.
Fifth, I continued with the rest of the instructions in php-5.1.3/INSTALL to complete the installation of PHP5. As a final I run 'make install' in which it connected to the Internet and downloaded PEAR to finish its job.

Now I have to look into some configurations parameters for Apache and PHP. Especially, the ones related to ssl and mysqli.

Basel 05-26-2006 04:58 AM

This guide will help you in the process of installing MySQL5, Apache2.2 and PHP5 on an VDS hosted by GoDaddy.com. This guide is based on SSH so if you are under Linux just run
Code:

$ ssh the-ip-address-of-your-vds -l user-name
If you have Windows you can use a tool called Putty. You can find more information about in Godday Help Center here: http://help.godaddy.com/index.php

First of all you have to make a decision whether to keep the current versions intact and disable the services they provide or remove them altogether. The disadvantage of keeping the current versions is that they start automatically when you restart your VDS. To overcome this problem you have to edit one or two configuration files by commenting the lines that run Apache2.0 and MySQL3. Another disadvantage is that the current binaries that are used to run MySQL3 and Apache2.0 will be in your PATH. This might cause you some confusing especially if you forgot to stop the services before running your own service, MySQL5 and Apache2.2 in this case. The only advantage of keeping the current version that I can think of now is that you can use the Simple Control Panel to configure MySQL3 and Apache2.0.

You can always opt to removing MySQL3 but keeping Apache2.0 and PHP4 or the other way around. There is one important thing that you have to keep in mind, that is you have to use the full path to your new binaries in order to run them unless you add the new directories to your PATH.

Step 1: Removing MySQL 3
There are few packages that you have to remove before removing MySQL3. To get an idea about which packages you need to remove run the following command as root:
Code:

shell> su - root
shell> rpm -e mysql-3.23.58-16.FC2.1

You will notice that there is a package called turbopanel-mysql-1.2.4-20060516.1202 in the output. I am not sure but it looks like that this package is related to the Simple Control Panel. As I said removing MySQL3 will remove MySQL from the list of configurable items under the Simple Control Panel. If you really want to remove MySQL3 then you have to stop it first then you can remove it and its dependencies. Simply run the following commands in sequence:
Code:

shell> mysqladmin -u root shutdown
shell> rpm -e mysql_passwd-0.7-2.swsoft
shell> rpm -e mysql-devel-3.23.58-16.FC2.1
shell> rpm -e turbopanel-1.2.4-20060516.1202
shell> rpm -e turbopanel-mysql-1.2.4-20060516.1202
shell> rpm -e mysql-server-3.23.58-16.FC2.1
shell> rpm -e libdbi-dbd-mysql-0.6.5-8.1
shell> rpm -e perl-DBD-MySQL-2.9003-4 mysql-3.23.58-16.FC2.1
shell> exit

Step 2: Installing MySQL5
First you have to download the latest release of MySQL5. As of May 24, 2006 it is version 5.0.21. So as a normal user create a temporary directory and then use wget to download MySQL5.
Code:

shell> cd
shell> mkdir temp
shell> wget http://mysql.sd2.mirrors.redwire.net/Downloads/MySQL-5.0/mysql-standard-5.0.21-linux-i686-glibc23.tar.gz

Now you have to login as root in order to create a new group and a new user dedicated to MySQL.
Code:

shell> su root
shell> groupadd mysql
shell> useradd -g mysql mysql
shell> cd /usr/local
shell> gunzip < ~/temp/mysql-standard-5.0.21-linux-i686-glibc32.tar.gz | tar xvf -
shell> ln -s /usr/local/mysql-standard-5.0.21-linux-i686-glibc23 mysql
shell> cd mysql
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root  .
shell> chown -R mysql data
shell> chgrp -R mysql .
shell> bin/mysqld_safe --user=mysql &
shell> exit

Note that the 'mysqld_safe --user=mysql' command is used to run MySQL as the new user that you have just created. I would strongly suggest you download and read MySQL documentation for further steps involved in securing your database and the initial accounts.

Step 3: Removing Apache2.0 and PHP4
I did not do remove them myself, however if you are interested you can use 'rpm -e' as in Step 1 but with different packages. You have to remove the following ones in particular:
Code:

shell> su - root
shell> rpm -e httpd-2.0.51
error: Failed dependencies:
        httpd is needed by (installed) hspc-wwwroot-1.0-14.fc1.swsoft
        httpd = 2.0.51 is needed by (installed) httpd-devel-2.0.51-2.9.1.swsoft
        httpd >= 2.0.40 is needed by (installed) mod_perl-1.99_12-2.1
        httpd = 2.0.51-2.9.1.swsoft is needed by (installed) mod_ssl-2.0.51-2.9.1.swsoft
        httpd is needed by (installed) squirrelmail-1.4.4-1.FC2.2.legacy
        httpd >= 2.0.40 is needed by (installed) mod_python-3.1.3-1.fc2.2
        httpd >= 2.0.40 is needed by (installed) mod_jk-1.2.15-1.fc2.gdg
        httpd >= 2.0.51 is needed by (installed) frontpage-5.0.sr1.2-0.fc2.gdg
        httpd >= 2.0.46 is needed by (installed) turbopanel-base-1.2.4-20060516.1202
        httpd-mmn = 20020903 is needed by (installed) mod_perl-1.99_12-2.1
        httpd-mmn = 20020903 is needed by (installed) mod_ssl-2.0.51-2.9.1.swsoft
        httpd-mmn = 20020903 is needed by (installed) php-4.3.11-1.fc2.3.legacy.1.swsoft
        httpd-mmn = 20020903 is needed by (installed) mod_python-3.1.3-1.fc2.2
        webserver is needed by (installed) mailman-2.1.5-10.fc2
        webserver is needed by (installed) webalizer-2.01_10-22


Step 4: Installing Apache 2.2

Installing Apache is a bit more involved than Installing MySQL since you have to configure it according to your needs. Apache is based on modular architecture in which services are usually running as modules. These modules can be compiled directly into the httpd binary, which is responsible for running Apache, or compiled as dynamic shared modules known as dynamic shared objects DSO that can be loaded when you first run your server. In the later case you specify the modules that you want to load in the httpd.conf file.
Apache has an excellent documentation that you can browse online or you can download and read it offline as well. The documentation would help you in identifying which modules you might need.

Before proceeding with the installation of Apache2.2 you have to stop Apache2.0 if it is currently running. To stop Apache2.0 to have to be root:
Code:

shell> su - root
shell> apache2ctl stop
shell> exit

Now make sure that you are running as a normal user and NOT as root. The options that I passed to the configure command below might not be applicable to your case.
Code:

shell> cd ~/temp
shell> wget http://apache.ziply.com/httpd/httpd-2.2.2.tar.bz2
shell> tar -xjf httpd-2.2.2.tar.bz2
shell> cd httpd-2.2.2
shell> ./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite --enable-speling --enable-ssl --enable-unique-id --enable-usertrack --enable-deflat --enable-expires --enable-auth-anon --enable-auth-dbm --enable-auth-digest --enable-logio --enable-mime-magic --enable-modules=most --enable-headers --enable-info --enable-v4-mapped && echo done-conf
shell> make -s && echo done-make
shell> su
shell> make install && echo done-inst
shell> exit
shell> cd ..

Step 5: Installing PHP5
If you followed the instructions in Step 4 then you are currently under ~/temp and is running as a normal user. Similar to Apache, you have to specify the options that you need to pass to the configure command in order to get PHP5 according to you needs.
Code:

shell> wget http://us3.php.net/distributions/php-5.1.4.tar.bz2
shell> tar -xjf php-5.1.4.tar.bz2
shell> cd php-5.1.4
shell> ./configure --with-apxs2=/usr/local/apache2/bin/apxs --enable-magic-quotes --disable-short-tags --with-openssl --with-zlib --with-bz2 --enable-ftp --with-gd --enable-mbstring --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-memory-limit && echo done-conf
shell> make -s && echo done-make
shell> su
shell> make install && echo done-inst

If everything went fine then congratulation you now have MySQL5, Apache2.2 and PHP5 on your VDS :)

Step 6: Configuring and Testing Apache2.2 and PHP5
You have to run the following commands as root
First, setup you php.ini file.
Code:

shell> cp ~/temp/php-51.4/php.ini-recommended /usr/local/lib/php.ini
Second, edit your http.conf to load the PHP module. Use your favorite text editor to add 'LoadModule php5_module modules/libphp5.so' without the single quotes to /usr/local/apache2/conf/httpd.conf
Third. tell Apache to parse certain extensions as PHP. Using your favorite text editor add 'AddType application/x-httpd-php .php' without the single quotes to /usr/local/apache2/conf/httpd.conf
Fourth, write a simple test page that would show you information about your PHP. configurations.
Code:

shell> cd /usr/local/apache2/htdocs
shell> cat > test.php << EOF
<?php phpinfo(); ?>
EOF
shell> cd ../bin
shell> ./apachectl start

Finally, open Firefox and visit the following link http://your-site/test.php


All times are GMT -5. The time now is 06:45 AM.