SolidHost Forums

SolidHost Forums (http://forums.solidhost.com/index.php)
-   Tutorials / How to? (http://forums.solidhost.com/forumdisplay.php?f=19)
-   -   Install PHP4 with PHP5 (DirectAdmin or Plain server) (http://forums.solidhost.com/showthread.php?t=439)

SH-Samuel Mar 6th, 2007 18:08

Install PHP4 with PHP5 (DirectAdmin or Plain server)
 
Hello,

Following are the steps to run PHP4 with PHP5:

First you need to compile php4 with apache and need to install php5 but do not compile it with apache.
You can use normal configure command to compile php4 with apache.

Now PHP5 Installation.

You can download the version of PHP5 you would like to install from http://php.net/

REMOVE the "--with-apxs=/usr/local/apache/bin/apxs" from the line. We are going to compile CGI version and it may broke the Apache!

b) Make sure you have the following prefixes and suffixes to install to the proper directories - otherwise currently installed php could be broken:
--prefix=/usr/local/php5 --exec-prefix=/usr/local/php5 --program-suffix=5

c) Add the necessary options for proper CGI redirects from Apache:
--enable-force-cgi-redirect --enable-discard-path

The result line will looks like this (please, do not use it - it has no CURL and PostgreSQL support - you better to follow steps below):

#./configure --prefix=/usr/local/php5 --exec-prefix=/usr/local/php5 --program-suffix=5 --with-xml --enable-bcmath --enable-calendar --enable-ftp --with-gd --enable-exif --with-jpeg-dir=/usr --with-png-dir=/usr --with-xpm-dir=/usr/X11R6 --with-imap --with-imap-ssl --with-kerberos --enable-mbstring --with-mbstring=all --enable-mbstr-enc-trans --with-mcrypt --with-mhash --enable-magic-quotes --with-mysql=/usr --with-openssl --enable-discard-path --with-pear --enable-sockets --enable-track-vars --with-ttf --with-freetype-dir=/usr --enable-versioning --with-zlib --with-pspell --with-gettext --enable-inline-optimization --disable-debug --enable-force-cgi-redirect --enable-discard-path

#make
#make install

#ln -s /usr/local/lib/php.ini /usr/local/php5/lib/php.ini

It is recommended to add the following line to the php.ini at the bottom (it is a MUST if you compile php4 instead php5!). Note that this line will broke regular php4. As a common rule - if you are using the same php.ini, do not add this line:

cgi.fix_pathinfo = 1 ; needed for CGI/FastCGI mode

Now we need to add several lines to Apache

#vi /usr/local/apache/conf/httpd.conf

Scroll down (better use the built-in search) to the "<IfModule mod_dir.c>"
There we should to add index.php5 after index.jp, but before index.php4. Result would looks like this:
====
<IfModule mod_dir.c>
DirectoryIndex index.html index.wml index.cgi index.shtml index.jsp index.js index.jp index.php5 iindex.php4 index.php3 index.php index.phtml ndex.htm default.htm default.html home.htm
</IfModule>
====

This to allow index.php5 as index file.

Continue editing. Find the "AddType application/x-httpd-php .phtml" and after it add this:
====
# PHP 5 Implementatie
ScriptAlias /php5/ /usr/local/php5/bin/
<Directory /usr/local/php5/bin/>
Options +ExecCGI
AllowOverride All
</Directory>

AddType application/x-httpd-php-5 .php5
Action application/x-httpd-php-5 /php5/php
====

#service httpd configtest
#service httpd stop
#service httpd start

Paul Huizer Apr 20th, 2007 13:26

And on a win VPS?

SH-Andre Apr 20th, 2007 13:47

On a Windows VPS, if you get Plesk as your control panel, it comes with PHP4 and 5 pre-installed and you will be able switch between the two PHP versions for each individual account.

This was added in the latest version of Plesk and it works great.

Paul Huizer Apr 20th, 2007 14:05

Super!
Tanx!

cyliew Aug 1st, 2007 09:08

What about Linux VPS with cPanel? Is there also such a switch option between PHP 4 and 5 available?

SH-Andre Aug 1st, 2007 09:33

cPanel doesn't have a switch feature like that, however you can choose either PHP4 or PHP5 through cPanel very easily.

Technically it may also be possible to install PHP4 and PHP5 to run at the same time with cPanel, but it's not natively supported and we also do not provide support for this.

cyliew Aug 1st, 2007 10:35

Andre, can you please give me a pointer where I can make such a selection between PHP 4 or 5 in cPanel?

SH-Andre Aug 1st, 2007 18:00

You can do that when recompiling Apache. The best way to do that, is to login to your VPS using SSH (as root), and enter the following command:

Code:

/scripts/easyapache
It's also possible to do this through cPanel.

cyliew Aug 1st, 2007 18:40

I found the option in cPanel to change the PHP version. You need to login as root in the cPanel WHM.
The option to select another PHP version you will find under 'Software -> Apache Update'.

SH-John Aug 1st, 2007 21:19

Quote:

Originally Posted by cyliew (Post 1676)
I found the option in cPanel to change the PHP version. You need to login as root in the cPanel WHM.
The option to select another PHP version you will find under 'Software -> Apache Update'.

Hello,

Sounds like you have it under control. Remember, you can always ask our support department to make these changes for you, if you have any doubts.


All times are GMT +2. The time now is 01:22.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.