php 5.2.17 and php 5.3.8? (not a feature request, but a request for help)

MACscr

Well-Known Member
Sep 30, 2003
198
5
168
cPanel Access Level
Root Administrator
So i have a system that currently is running php 5.3.8 as suphp. Have a long time client on that system that found out recently his outdated cart requires php 5.2.x until it can be upgraded. Im wanting to setup php 5.2.x for him to use a couple months until he can get his update scheduled, etc. I was give some general advice from a friend:

compile a new version of php with a prefix such as /usr/local/php52
add a line to /opt/suphp/etc/suphp.conf and add handlers in /etc/httpd/conf/php.conf
I honestly havent compiled php from scratch, at least not in this type of environment. Ive got the source downloaded from php.net and extracted into the correct folder. Is there an easy way for me to figure out whats configured with php 5.3.8 so that the same options (obviously stuff thats still compatible with 5.2.x) can be used to configure php 5.2.17? Also, what do i need to do so that i can setup this php version to be the default php handler just for him?

Any help and especially detailed instructions would be sincerely appreciated. Im only a one man shop and i have another large project that is due in the next 36 hours, so have to concentrate on that, but I would like to be able to get this other client with the php issue back to a fully functional site as soon as possible, thus my call out for help. Thanks!
 

MACscr

Well-Known Member
Sep 30, 2003
198
5
168
cPanel Access Level
Root Administrator
Re: php 5.2.17 and php 5.3.8? (not a feature request, but a request for hel

Yes, hence why i said this wasnt a feature request and why i am looking for instructions for doing it manually and without EA.
 

sirdopes

Well-Known Member
PartnerNOC
Sep 25, 2007
141
0
66
Re: php 5.2.17 and php 5.3.8? (not a feature request, but a request for hel

Download the source and extract. Run something like the following configure line and then make and make install.

Code:
./configure  --enable-bcmath --enable-calendar --enable-dbase --enable-exif --enable-fastcgi --enable-ftp --enable-gd-native-ttf --enable-libxml --enable-magic-quotes --enable-mbstring --enable-pdo=shared --enable-soap --enable-sockets --enable-sqlite-utf8 --enable-wddx --enable-zip --prefix=/opt/php52 --with-bz2 --with-curl=/opt/curlssl/ --with-freetype-dir=/usr --with-gd --with-gettext --with-imap=/opt/php_with_imap_client/ --with-imap-ssl=/opt/openssl --with-jpeg-dir=/usr --with-kerberos --with-libexpat-dir=/usr --with-libxml-dir=/opt/xml2 --with-libxml-dir=/opt/xml2/ --with-mcrypt=/opt/libmcrypt/ --with-mhash=/opt/mhash/ --with-mime-magic --with-mysql=/usr --with-mysql-sock=/var/lib/mysql/mysql.sock --with-mysqli=/usr/bin/mysql_config --with-openssl=/opt/openssl --with-openssl-dir=/opt/openssl --with-pcre-regex=/opt/pcre --with-pdo-mysql=shared --with-pdo-sqlite=shared,/usr --with-png-dir=/usr --with-pspell --with-sqlite=shared --with-tidy=/opt/tidy/ --with-ttf --with-unixODBC=/usr --with-xmlrpc --with-xpm-dir=/usr --with-xsl=/opt/xslt/ --with-zlib --with-zlib-dir=/usr --enable-intl
The configure options will vary depending on the options that you need.

Edit the file /opt/suphp/etc/suphp.conf and look for the following section.
Code:
[handlers]
;Handler for php-scripts
application/x-httpd-php4="php:/usr/php4/bin/php"
application/x-httpd-php5="php:/usr/bin/php"
application/x-httpd-php52="php:/opt/php52/bin/php-cgi"
application/x-httpd-php52="php:/opt/php52/bin/php-cgi <-- this is the one that you want to add.

In the file /usr/local/apache/conf/includes/pre_main_global.conf add:
Code:
 AddType application/x-httpd-php52 .php52
<Directory />
    suPHP_AddHandler application/x-httpd-php52
</Directory>
Then in your clients .htaccess you can use the following to use php 5.2.

Code:
AddType application/x-httpd-php52 .php
 

JayFromEpic

Well-Known Member
Apr 2, 2011
218
8
68
Scottsdale
cPanel Access Level
Root Administrator
Twitter
Re: php 5.2.17 and php 5.3.8? (not a feature request, but a request for hel

What cart is he using if you dont mind me asking.

Also, to my knowledge, 5.2.x is the only REAL stable version of PHP that will work fully with things such as Ioncube, Zend, and some other server side apps. I may be wrong but if I am, feel free to correct me.
 

handsonhosting

Well-Known Member
Feb 17, 2002
151
0
316
Omaha, NE
cPanel Access Level
Root Administrator
Re: php 5.2.17 and php 5.3.8? (not a feature request, but a request for hel

We have a few hundred servers operating PHP 5.3.x with IonCube and have no issues at all.
Of course, Zend Optimizer would not work on the PHP 5.3 platform, so some users have opted to stay on our 5.2.x machines, but many users are using PHP 5.3 with IonCube and not seeing any issues. PHP 5.2 is stable, but PHP 5.3 is stable too. Be aware that PHP 5.2 is no longer supported by PHP - so really you shoudl be upgrading to the later release at this point.
 

micho101

Member
Sep 29, 2008
20
0
51
Re: php 5.2.17 and php 5.3.8? (not a feature request, but a request for hel

@Sirdopes

Great solution for us, who need to enable PHP 5.2.x for just a few sites with legacy PHP apps. Thanks.