Go Back   SolidHost Forums Support Forums Tutorials / How to?

Reply
 
Thread Tools Display Modes
Old Mar 6th, 2007, 18:08   #1
SH-Samuel
SolidHost Crew
 
Join Date: Nov 2006
Posts: 3
Default 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

-----------------
Best Regards,
Samuel Taylor
SolidHost Engineer
SH-Samuel is offline   Reply With Quote
Old Apr 20th, 2007, 13:26   #2
Paul Huizer
Customer
 
Join Date: Apr 2007
Posts: 7
Default

And on a win VPS?
Paul Huizer is offline   Reply With Quote
Old Apr 20th, 2007, 13:47   #3
SH-Andre
SolidHost Crew
 
Join Date: Sep 2001
Posts: 850
Default

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.

-----------------
Andre van Vliet
SolidHost Administrators

Solid as a Rock
SH-Andre is offline   Reply With Quote
Old Apr 20th, 2007, 14:05   #4
Paul Huizer
Customer
 
Join Date: Apr 2007
Posts: 7
Default

Super!
Tanx!
Paul Huizer is offline   Reply With Quote
Old Aug 1st, 2007, 09:08   #5
cyliew
Customer
 
Join Date: May 2007
Posts: 3
Default

What about Linux VPS with cPanel? Is there also such a switch option between PHP 4 and 5 available?
cyliew is offline   Reply With Quote
Old Aug 1st, 2007, 09:33   #6
SH-Andre
SolidHost Crew
 
Join Date: Sep 2001
Posts: 850
Default

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.

-----------------
Andre van Vliet
SolidHost Administrators

Solid as a Rock
SH-Andre is offline   Reply With Quote
Old Aug 1st, 2007, 10:35   #7
cyliew
Customer
 
Join Date: May 2007
Posts: 3
Default

Andre, can you please give me a pointer where I can make such a selection between PHP 4 or 5 in cPanel?
cyliew is offline   Reply With Quote
Old Aug 1st, 2007, 18:00   #8
SH-Andre
SolidHost Crew
 
Join Date: Sep 2001
Posts: 850
Default

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.

-----------------
Andre van Vliet
SolidHost Administrators

Solid as a Rock
SH-Andre is offline   Reply With Quote
Old Aug 1st, 2007, 18:40   #9
cyliew
Customer
 
Join Date: May 2007
Posts: 3
Default

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'.
cyliew is offline   Reply With Quote
Old Aug 1st, 2007, 21:19   #10
SH-John
Customer
 
Join Date: Jan 2007
Posts: 51
Default

Quote:
Originally Posted by cyliew View Post
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.

-----------------
Best Regards,
John Strong
SolidHost Chief Operational Officer
SH-John is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT +2. The time now is 10:11.