Howto build php 5.3.x (cgi) 5.2.x (cli)
This is the config I ended up with (cloudlinux option is optional by the way):
installation
Code:cd /usr/local/directadmin/custombuild ./build set custombuild 1.2 ./build update ./build set autover no cp -Rp configure custom cp -pf configure/suphp/configure.php5 custom/suphp/configure.php6 perl -pi -e 's/php5:/phprep:/' versions.txt perl -pi -e 's/php6/php5/' versions.txt perl -pi -e 's/phprep/php6/' versions.txt ./build set cloudlinux yes ./build set php5_ver 5.3 ./build set php6_cgi no ./build set php6_cli yes ./build set php5_cgi yes ./build set php5_cli no ./build php nAfter the build script finishes, it tries to restart apache, but can’t because libphp6.so cannot be found, this is likely because the build script has libphp6.so hardcoded somewhere and because we’re using that to cheat our way through this procedure, we can use sed to fix it;
Code:sed -i 's/php6/php5/g' /etc/httpd/conf/extra/httpd-phpmodules.conf service httpd restartswitching using a .htaccess
Switching from the default can now be done with a .htaccess in a users’ public_html dir.Code:<FilesMatch "\.(inc|php|php3|php4|php5|php6|phtml|phps)$"> SetHandler application/x-httpd-php </FilesMatch>ioncube loader
If you also want to add ioncube support to the 5.2 module, you need a workaround in order to be able to build ioncube as well.Code:./build set php6_cli no && ./build ioncube && ./build php6_cli yes ionCube loader has been installed. cp /usr/local/directadmin/custombuild/ioncube/ioncube_loader_lin_5.2.so /usr/local/lib/ echo "zend_extension=/usr/local/lib/ioncube_loader_lin_5.2.so" >> /usr/local/lib/php.iniusing pecl
Setting up pecl is easy too, just need to point it to the right config file:Code:/usr/local/bin/pecl config-set php_ini /usr/local/lib/php.ini /usr/local/bin/pear config-set php_ini /usr/local/lib/php.ini /usr/local/php5/bin/pear config-set php_ini /usr/local/etc/php5/cgi/php.ini /usr/local/php5/bin/pecl config-set php_ini /usr/local/etc/php5/cgi/php.iniThen you can use either pecl to install modules like apc, imagemagick, etc.
final result
Code:/usr/local/bin/php -v PHP 5.2.17 (cli) (built: Sep 4 2012 16:43:01) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies with the ionCube PHP Loader v4.2.2, Copyright (c) 2002-2012, by ionCube Ltd. /usr/local/php5/bin/php -v PHP 5.3.16 (cli) (built: Sep 4 2012 16:46:05) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies with the ionCube PHP Loader v4.2.2, Copyright (c) 2002-2012, by ionCube Ltd.