After much research and experimentation I have found that creating a secondary/test php install is not too hard, but can be challenging if you don’t know what you’re doing. I spent all night working on creating a decent installation of php. First of all you need to install these packages for your (CentOS or Fedora) server.
yum install aspell-devel curl-devel cyrus-sasl-devel e2fsprogs-devel freetype-devel glibc-devel keyutils-libs-devel krb5-devel libgcc libidn-devel libjpeg-devel libpng-devel libselinux-devel libsepol-devel libstdc++-devel libX11-devel libXau-devel libXdmcp-devel libxml2-devel libXpm-devel mysql-devel net-snmp-devel openldap-devel openssl-devel tcp_wrappers zlib-devel
After you have those you can then go about downloading and installing the developers version of PHP:
wget http://downloads.php.net/stas/php-5.4.0RC7.tar.gz
tar xzf php-5.4.0RC7.tar.gz
cd php-5.4.0RC7
Note: You can use this method with any version of PHP.
After this we can then get to creating the configure for the make and install, pay attention to the –prefix=/opt/phpdev because that represents the location we will use:
./configure --disable-fileinfo --enable-bcmath --enable-calendar --enable-exif --enable-ftp --enable-gd-native-ttf --enable-libxml --enable-mbstring --enable-pdo=shared --enable-soap --enable-sockets --enable-wddx --enable-zip --prefix=/opt/phpdev --with-bz2 --with-curl=/opt/curlssl/ --with-freetype-dir=/usr --with-gd --with-gettext --with-imap=/opt/php_with_imap_client/ --with-imap-ssl=/usr --with-jpeg-dir=/usr --with-kerberos --with-libdir=lib64 --with-libexpat-dir=/usr --with-libxml-dir=/opt/xml2 --with-libxml-dir=/opt/xml2/ --with-mcrypt=/opt/libmcrypt/ --with-mysql=/usr --with-mysql-sock=/var/lib/mysql/mysql.sock --with-mysqli=/usr/bin/mysql_config --with-openssl=/usr --with-openssl-dir=/usr --with-pcre-regex=/opt/pcre --with-pdo-mysql=shared --with-pdo-sqlite=shared --with-pic --with-png-dir=/usr --with-pspell --with-tidy=/opt/tidy/ --with-xmlrpc --with-xpm-dir=/usr --with-xsl=/opt/xslt/ --with-zlib --with-zlib-dir=/usr --with-config-file-path=/opt/phpdevmake
make test
make install
We then want want to edit the /opt/suphp/etc/suphp.conf file and make sure that we add the following line to the section after [handlers] ;Handler for php-scripts:
application/x-httpd-phpdev="php:/opt/phpdev/bin/php-cgi"
In the file /usr/local/apache/conf/includes/pre_main_global.conf you will need to add:
AddType application/x-httpd-phpdev .phpdev
<Directory />
suPHP_AddHandler application/x-httpd-phpdev
</Directory>
And finally to use it anywhere you just need to add the following to your .htaccess for the folder you want to test in the development version:
AddType application/x-httpd-phpdev .php
That essentially sums up the general creation of a testing version of php and the above modules to the config command can definitely be changed and added to or have some removed, etc. Just remember to have fun!
