{"id":830,"date":"2013-12-26T03:53:18","date_gmt":"2013-12-26T01:53:18","guid":{"rendered":"http:\/\/www.shukko.com\/x3\/?p=830"},"modified":"2013-12-26T03:53:18","modified_gmt":"2013-12-26T01:53:18","slug":"howto-build-php-5-3-x-cgi-5-2-x-cli","status":"publish","type":"post","link":"https:\/\/www.shukko.com\/x3\/2013\/12\/26\/howto-build-php-5-3-x-cgi-5-2-x-cli\/","title":{"rendered":"Howto build php 5.3.x (cgi) 5.2.x (cli)"},"content":{"rendered":"<h2>Howto build php 5.3.x (cgi) 5.2.x (cli)<\/h2>\n<div>\n<div id=\"post_message_227449\">\n<blockquote><p>This is the config I ended up with (cloudlinux option is optional by the way):<\/p>\n<p><b>installation<\/b><\/p>\n<div>\n<div>Code:<\/div>\n<pre>cd \/usr\/local\/directadmin\/custombuild\r\n.\/build set custombuild 1.2\r\n.\/build update\r\n.\/build set autover no\r\ncp -Rp configure custom\r\ncp -pf configure\/suphp\/configure.php5 custom\/suphp\/configure.php6\r\nperl -pi -e 's\/php5:\/phprep:\/' versions.txt\r\nperl -pi -e 's\/php6\/php5\/' versions.txt\r\nperl -pi -e 's\/phprep\/php6\/' versions.txt\r\n.\/build set cloudlinux yes\r\n.\/build set php5_ver 5.3\r\n.\/build set php6_cgi no\r\n.\/build set php6_cli yes\r\n.\/build set php5_cgi yes\r\n.\/build set php5_cli no\r\n.\/build php n<\/pre>\n<\/div>\n<p>After the build script finishes, it tries to restart apache, but can&#8217;t because libphp6.so cannot be found, this is likely because the build script has libphp6.so hardcoded somewhere and because we&#8217;re using that to cheat our way through this procedure, we can use sed to fix it;<\/p>\n<div>\n<div>Code:<\/div>\n<pre>sed -i 's\/php6\/php5\/g' \/etc\/httpd\/conf\/extra\/httpd-phpmodules.conf\r\nservice httpd restart<\/pre>\n<\/div>\n<p><b>switching using a .htaccess<\/b><br \/>\nSwitching from the default can now be done with a .htaccess in a users&#8217; public_html dir.<\/p>\n<div>\n<div>Code:<\/div>\n<pre>&lt;FilesMatch \"\\.(inc|php|php3|php4|php5|php6|phtml|phps)$\"&gt;\r\nSetHandler application\/x-httpd-php\r\n&lt;\/FilesMatch&gt;<\/pre>\n<\/div>\n<p><b>ioncube loader<\/b><br \/>\nIf 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.<\/p>\n<div>\n<div>Code:<\/div>\n<pre>.\/build set php6_cli no &amp;&amp; .\/build ioncube &amp;&amp; .\/build php6_cli yes\r\nionCube loader has been installed.\r\ncp \/usr\/local\/directadmin\/custombuild\/ioncube\/ioncube_loader_lin_5.2.so \/usr\/local\/lib\/\r\necho \"zend_extension=\/usr\/local\/lib\/ioncube_loader_lin_5.2.so\" &gt;&gt; \/usr\/local\/lib\/php.ini<\/pre>\n<\/div>\n<p><b>using pecl<\/b><br \/>\nSetting up pecl is easy too, just need to point it to the right config file:<\/p>\n<div>\n<div>Code:<\/div>\n<pre>\/usr\/local\/bin\/pecl config-set php_ini \/usr\/local\/lib\/php.ini\r\n\/usr\/local\/bin\/pear config-set php_ini \/usr\/local\/lib\/php.ini\r\n\/usr\/local\/php5\/bin\/pear config-set php_ini \/usr\/local\/etc\/php5\/cgi\/php.ini\r\n\/usr\/local\/php5\/bin\/pecl config-set php_ini \/usr\/local\/etc\/php5\/cgi\/php.ini<\/pre>\n<\/div>\n<p>Then you can use either pecl to install modules like apc, imagemagick, etc.<\/p>\n<p><b>final result<\/b><\/p>\n<div>\n<div>Code:<\/div>\n<pre>\/usr\/local\/bin\/php -v\r\nPHP 5.2.17 (cli) (built: Sep  4 2012 16:43:01)\r\nCopyright (c) 1997-2010 The PHP Group\r\nZend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies\r\n    with the ionCube PHP Loader v4.2.2, Copyright (c) 2002-2012, by ionCube Ltd.\r\n\r\n\/usr\/local\/php5\/bin\/php -v\r\nPHP 5.3.16 (cli) (built: Sep  4 2012 16:46:05)\r\nCopyright (c) 1997-2012 The PHP Group\r\nZend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies\r\n    with the ionCube PHP Loader v4.2.2, Copyright (c) 2002-2012, by ionCube Ltd.<\/pre>\n<\/div>\n<\/blockquote>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>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 &#8216;s\/php5:\/phprep:\/&#8217; versions.txt perl -pi -e &#8216;s\/php6\/php5\/&#8217; versions.txt perl [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-830","post","type-post","status-publish","format-standard","hentry","category-kategerisiz"],"_links":{"self":[{"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/posts\/830","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/comments?post=830"}],"version-history":[{"count":1,"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/posts\/830\/revisions"}],"predecessor-version":[{"id":831,"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/posts\/830\/revisions\/831"}],"wp:attachment":[{"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/media?parent=830"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/categories?post=830"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/tags?post=830"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}