Compile PHP 5.3 via CustomBuild in Direct Admin

This is the step on how to compile your PHP into the latest version (or vice versa, according to your preferences) using CustomBuild in Direct Admin servers.

Note: This same procedure also can be applied with any other supported modules in Direct Admin. Just type “./build” to list out the things that you are able to update.

First, go to this folder:
/usr/local/directadmin/custombuild

Then modify the option.conf:
nano options.conf

Try to find this string:
php5_ver=

In my case, my current php is 5.2 and i need to recompile it to 5.3, so my current option.conf should looks like this:
php5_ver=5.2

and modified to this:
php5_ver=5.3

Save and close it.

Next, to download the updated version, type:
./build update

After the download is done, then finally we can start compiling by typing this:
./build php n

The compiling process should take a while. But just in case you ran into this kind of error:
virtual memory exhausted: Cannot allocate memory
make: *** [ext/date/lib/tm2unixtime.lo] Error 1
make: *** Waiting for unfinished jobs….
virtual memory exhausted: Cannot allocate memory
make: *** [ext/date/lib/parse_tz.lo] Error 1
virtual memory exhausted: Cannot allocate memory
make: *** [ext/date/lib/parse_date.lo] Error 1

So you are running out of RAM. Make sure too add enough RAM for the process to proceed.

Finally when finished, it will restart the httpd by itself. You can check the php version by typing “php -v” and the result as below will appear:
Before:
[root@server custombuild]# php -v
PHP 5.2.13 (cli) (built: JulĀ  7 2010 01:09:45)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies

and after:
[root@server custombuild]# php -v
PHP 5.3.2 (cli) (built: JulĀ  8 2010 07:36:44)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

Happy compiling.

Leave a Reply