Running php 4.x.x and 5.x.x together - possible?

the_bobara

Well-Known Member
PartnerNOC
Sep 23, 2004
92
0
156
Bulgaria
cPanel Access Level
Root Administrator
Hello
Did someone try to run php 4 and 5 together.
Some servers are confgired with php 4 and 5.and when you want to use scripts coded in php 5 you have to name it *.php5...
how to do this please help....



cPanel box:
WHM 9.9.9 cPanel 9.9.9-S15
CentOS 3.3 i686 - WHM X v3.1.0

excuse me for my English
 

dezignguy

Well-Known Member
Sep 26, 2004
533
0
166
why not post the instructions here for others?

I'm not planning to do it myself, but it would still be interesting to read.
 

fusioncroc

Well-Known Member
Sep 28, 2004
261
0
166
U.K.
cd /usr/local
wget http://uk2.php.net/get/php-5.0.3.tar.gz/from/www.php.net/mirror
tar -xvzf php-5.0.3.tar.gz.1
cd php-5.0.3
./configure' '--with-xml' '--enable-bcmath' '--enable-calendar' '--enable-ftp' '--enable-magic-quotes' '--with-mysql' '--enable-discard-path' '--with-pear' '--enable-sockets' '--enable-track-vars' '--enable-versioning' '--with-zlib' '--disable-debug' '--prefix=/usr/local/php5' '--enanble-force-cgi-redirect' '--with-config-file=/usr/local/php5/lib/php.ini' '--with-config-file-path=/usr/local/php5/lib/
make
make install
cd /usr/local/
cp php-5.0.3/php.ini-dist php5/lib/php.ini
rm -rf php-5.0.3.tar.gz.1

----------------------------------------------------------------------
php5 should now be installed along php4 now do the following
--------------------------------------------------------------------------
cd /usr/local/apache/conf/
pico httpd.conf
ctr + w addtype
---------------------------------------------------------------------------
add below the php4 add types
-----------------------------------------------------------------------------
AddType application/x-httpd-php5 .php5
ScriptAlias /php/ "/usr/local/php5/bin/"
Action application/x-httpd-php5 "/php/php"


-------------------------------------------------------------------------------
last thing
------------------------------------------------------------------------------
service httpd restart

then create a file called phpinfo.php5 and create phpinfo.php and put the following code in it
------------------------------------------------------------------------------------------------------
<?php phpinfo('');
?>

then test it out it should most of the time work
 
Last edited:

Earendil

Well-Known Member
Jun 10, 2004
102
0
166
fusioncroc said:
cd /usr/local
wget http://uk2.php.net/get/php-5.0.3.tar.gz/from/www.php.net/mirror
tar -xvzf php-5.0.3.tar.gz.1
cd php-5.0.3
./configure' '--with-xml' '--enable-bcmath' '--enable-calendar' '--enable-ftp' '--enable-magic-quotes' '--with-mysql' '--enable-discard-path' '--with-pear' '--enable-sockets' '--enable-track-vars' '--enable-versioning' '--with-zlib' '--disable-debug' '--prefix=/usr/local/php5' '--enahble-force-cgi-redirect' '--with-config-file=/usr/local/php5/lib/php.ini' '--with-config-file-path=/usr/local/php5/lib/
make
make install
cd /usr/local/
cp php-5.0.3/php.ini-dist php5/lib/php.ini
rm -rf php-5.0.3.tar.gz.1

----------------------------------------------------------------------
php5 should now be installed along php4 now do the following
--------------------------------------------------------------------------
cd /usr/local/apache/conf/
pico httpd.conf
ctr + w addtype
---------------------------------------------------------------------------
add below the php4 add types
-----------------------------------------------------------------------------
AddType application/x-httpd-php5 .php5
ScriptAlias /php/ "/usr/local/php5/bin/"
Action application/x-httpd-php5 "/php/php"


-------------------------------------------------------------------------------
last thing
------------------------------------------------------------------------------
service httpd restart

then create a file called phpinfo.php5 and create phpinfo.php and put the following code in it
------------------------------------------------------------------------------------------------------
<?php phpinfo('');
?>

then test it out it should most of the time work

Doesn't work here; not only that, but after it's installed you suddenly get weird requests from all over the place!
 

the_bobara

Well-Known Member
PartnerNOC
Sep 23, 2004
92
0
156
Bulgaria
cPanel Access Level
Root Administrator
it doesn`t work

root@teddy [/usr/local/php-5.0.3]# ./configure' '--with-xml' '--enable-bcmath' '--enable-calendar' '--enable-ftp' '--enable-magic-quotes' '--with-mysql' '--enable-discard-path' '--with-pear' '--enable-sockets' '--enable-track-vars' '--enable-versioning' '--with-zlib' '--disable-debug' '--prefix=/usr/local/php5' '--enahble-force-cgi-redirect' '--with-config-file=/usr/local/php5/lib/php.ini' '--with-config-file-path=/usr/local/php5/lib/
-bash: ./configure --with-xml --enable-bcmath --enable-calendar --enable-ftp --enable-magic-quotes --with-mysql --enable-discard-path --with-pear --enable-sockets --enable-track-vars --enable-versioning --with-zlib --disable-debug --prefix=/usr/local/php5 --enahble-force-cgi-redirect --with-config-file=/usr/local/php5/lib/php.ini --with-config-file-path=/usr/local/php5/lib/: No such file or directory
 

jamesbond

Well-Known Member
Oct 9, 2002
737
1
168
Haven't tried it but I noticed a mistake in the config

'--enahble-force-cgi-' should be be '--enable-force-cgi-'
 

fusioncroc

Well-Known Member
Sep 28, 2004
261
0
166
U.K.
sorry i was typing it up quick i'll edit the post
btw i dont think it works with php4 as cgi as well
 

Earendil

Well-Known Member
Jun 10, 2004
102
0
166
The configuring and all works, but I get a 500 error; premature end of headers.
 

hekri

Well-Known Member
Oct 14, 2003
147
2
168
working fine but if you have i httpd.conf User login Group login you must delete this or
#User login
#Group login
 

emeric21

Well-Known Member
Aug 5, 2002
49
0
156
i get this error:

[/usr/local/php-5.0.3]# ./configure' '--with-xml' '--enable-bcmath' '--enable-calendar' '--enable-ftp' '--enable-magic-quotes' '--with-mysql' '--enable-discard-path' '--with-pear' '--enable-sockets' '--enable-track-vars' '--enable-versioning' '--with-zlib' '--disable-debug' '--prefix=/usr/local/php5' '--enable-force-cgi-redirect' '--with-config-file=/usr/local/php5/lib/php.ini' '--with-config-file-path=/usr/local/php5/lib/
-bash: ./configure --with-xml --enable-bcmath --enable-calendar --enable-ftp --enable-magic-quotes --with-mysql --enable-discard-path --with-pear --enable-sockets --enable-track-vars --enable-versioning --with-zlib --disable-debug --prefix=/usr/local/php5 --enable-force-cgi-redirect --with-config-file=/usr/local/php5/lib/php.ini --with-config-file-path=/usr/local/php5/lib/: No such file or directory
Someone can help?
 

Mr.Alien

Registered
Mar 1, 2005
4
0
151
I'm running both php4 and php5 on my server. I've done this an onther way.
I have 2 apaches running. One for php4 and one for php5. The one for php4 on port 80 and the other on 81. I also setup a reverse proxy between the 2 apaches. This way i forward all php5 request on the port80 to the other.

I also writen a script to copy all virtual host tag in the from the one to the other config file. And run this every night.
 

the_bobara

Well-Known Member
PartnerNOC
Sep 23, 2004
92
0
156
Bulgaria
cPanel Access Level
Root Administrator
hey,
did somebody successed to run php4 and php5 as CGI ?
i got this error
Code:
 ./configure' '--with-xml' '--enable-bcmath' '--enable-calendar' '--enable-ftp' '--enable-magic-quotes' '--with-mysql' '--enable-discard-path' '--with-pear' '--enable-sockets' '--enable-track-vars' '--enable-versioning' '--with-zlib' '--disable-debug' '--prefix=/usr/local/php5' '--enable-force-cgi-redirect' '--with-config-file=/usr/local/php5/lib/php.ini' '--with-config-file-path=/usr/local/php5/lib/
-bash: ./configure --with-xml --enable-bcmath --enable-calendar --enable-ftp --enable-magic-quotes --with-mysql --enable-discard-path --with-pear --enable-sockets --enable-track-vars --enable-versioning --with-zlib --disable-debug --prefix=/usr/local/php5 --enable-force-cgi-redirect --with-config-file=/usr/local/php5/lib/php.ini --with-config-file-path=/usr/local/php5/lib/: No such file or directory
 

SEAL31

Well-Known Member
Dec 4, 2004
55
0
156
If you are getting the error when you put in the code, rmeove the first ' after ./configure.

It looks like:

./configure'

But should be:

./configure
 

wildbomb

Member
Jun 24, 2003
8
0
151
hekri said:
working fine but if you have i httpd.conf User login Group login you must delete this or
#User login
#Group login
Has anyone an idea how to make this work without commenting out this lines on every VirtualHost that you want it to work?

Has it something to do with PHPSuexec?
Where can the permissions be set, for what are these Tags in the VirtualHost?

Thanks