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:
12345678910111213141516 cd /usr/local/directadmin/custombuild./build set custombuild 1.2./build update./build set autover nocp -Rp configure customcp -pf configure/suphp/configure.php5 custom/suphp/configure.php6perl -pi -e 's/php5:/phprep:/' versions.txtperl -pi -e 's/php6/php5/' versions.txtperl -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 n
After 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:
12 sed -i 's/php6/php5/g' /etc/httpd/conf/extra/httpd-phpmodules.confservice httpd restart
switching using a .htaccess
Switching from the default can now be done with a .htaccess in a users’ public_html dir.Code:
123 <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:
1234 ./build set php6_cli no && ./build ioncube && ./build php6_cli yesionCube 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.ini
using pecl
Setting up pecl is easy too, just need to point it to the right config file:Code:
1234 /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.ini
Then you can use either pecl to install modules like apc, imagemagick, etc.
final result
Code:
1234567891011 /usr/local/bin/php -vPHP 5.2.17 (cli) (built: Sep 4 2012 16:43:01)Copyright (c) 1997-2010 The PHP GroupZend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologieswith the ionCube PHP Loader v4.2.2, Copyright (c) 2002-2012, by ionCube Ltd./usr/local/php5/bin/php -vPHP 5.3.16 (cli) (built: Sep 4 2012 16:46:05)Copyright (c) 1997-2012 The PHP GroupZend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologieswith the ionCube PHP Loader v4.2.2, Copyright (c) 2002-2012, by ionCube Ltd.