HOW TO: Build PHP from Snapshot Source with PECL Modules.

sde

Verified User
Joined
Sep 11, 2004
Messages
215
Location
Temecula, CA
DirectAdmin requires a specific naming of the tar file and its contents to successfully build with the customapache scripts.

This makes it dififcult to build snapshots because the tar.gz files are named without a dash after the 'php' in the filename.

It also makes it difficult to use PECL modules because they don't exist in the PHP tar file and when you run a ./build clean, your extracted PHP directory is wiped out.

Below are the steps I use to build PHP from snapshot source with custom PECL modules.


1. Download a version of PHP. For this example, i'm going to use a 5.2.0 snapshot from http://snaps.php.net/ .
Code:
# cd /usr/local/directadmin/customapache/
# wget [url]http://snaps.php.net/php5.2-yyyymmddhhmm.tar.gz[/url]
2. Extract the file and rename it in the appropriate format. The correct format is: php-<version>. Example: php-5.2.0
Code:
# tar -zxvf php5.2-yyyymmddhhmm.tar.gz
# mv php5.2-yyyymmddhhmm.tar.gz php-5.2.0

3. Add any PECL extensions you would like to the ext/ directory of PHP. Example for the uploadprogress extension: /usr/local/directadmin/customapache/php-5.2.0/ext/upoadprogress. Note that after decompressing the extension, there is usually a version number at the end. Make sure you rename the file without the version number and that it is all lower case.
Code:
# cd /usr/local/directadmin/customapache/php-5.2.0/ext/
# wget [url]http://pecl.php.net/get/uploadprogress-0.3.0.tgz[/url]
# tar -zxvf uploadprogress-0.3.0.tgz
# mv uploadprogress-0.3.0 uploadprogress
# rm uploadprogress-0.3.0.tgz

4. Delete the PHP configure file and create a new one. This makes sure that your PECL modules are included as options for your build.
Code:
# cd /usr/local/directadmin/customapache/php-5.2.0/
# rm configure
# ./buildconf --force

5. If you added PECL extensions, make sure you add the appropriate configuration option to /usr/local/directadmin/customapache/configure.php. If you are unsure at the configuration option, you can run ./configure --help in the php-5.2.0 directory. On the same topic, you may want to review all the options of your version of PHP to see everthing that is available and compare with your current configure.php file. The option list can be pretty long so I usually create a file to view with my configure script side by side. ./configure --help > conf_options.txt

6. Create the tar.gz file for the new PHP directory with the extensions.
Code:
# cd /usr/local/directadmin/customapache/
# gtar cvzf php-5.2.0 php-5.2.0.tar.gz

7. Make sure that the PHP version you want to compile is defined in /usr/local/directadmin/customapache/build.

8. Now build PHP like you normally would.
Code:
# cd /usr/local/directadmin/customapache/
# ./build clean
# ./build php
 
Last edited:
It is not required in customapache, because it doesn't check if the package is corrupted or not :) Only custombuild requires a MD5 checksum.
 
Im trying to install memcached but I'm using custombuild on centos 5. Can you please help me with this?

The closest I came with help of..

http://codelikezell.com/how-to-install-memcached-on-centos/

It seems I have libevent installed allready:

[root@webs memcached-1.4.5]# locate libevent
/usr/lib/libevent-1.4.so.2
/usr/lib/libevent-1.4.so.2.1.3
/usr/lib/libevent_core-1.4.so.2
/usr/lib/libevent_core-1.4.so.2.1.3
/usr/lib/libevent_extra-1.4.so.2
/usr/lib/libevent_extra-1.4.so.2.1.3
/usr/lib64/libevent-1.4.so.2
/usr/lib64/libevent-1.4.so.2.1.3
/usr/lib64/libevent_core-1.4.so.2
/usr/lib64/libevent_core-1.4.so.2.1.3
/usr/lib64/libevent_extra-1.4.so.2
/usr/lib64/libevent_extra-1.4.so.2.1.3
/usr/share/doc/libevent-1.4.13
/usr/share/doc/libevent-1.4.13/README

Still I can't install it:

[root@webs usr]# cd /usr/local/src/memcached-1.4.5
[root@webs memcached-1.4.5]# ./configure --with-libevent=/usr/lib/
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for icc in use... no
checking for Sun cc in use... no
checking for gcc option to accept ISO C99... -std=gnu99
checking whether gcc -std=gnu99 and cc understand -c and -o together... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking sasl/sasl.h usability... no
checking sasl/sasl.h presence... no
checking for sasl/sasl.h... no
checking for gcov... /usr/bin/gcov
checking for main in -lgcov... yes
checking for libevent directory... configure: error: libevent is required. You can get it from http://www.monkey.org/~provos/libevent/

If it's already installed, specify its path using --with-libevent=/dir/

I also tried: ./configure --with-libevent=/usr/lib64/

But still it gives:

checking for libevent directory... configure: error: libevent is required. You can get it from http://www.monkey.org/~provos/libevent/

If it's already installed, specify its path using --with-libevent=/dir/

Any help would be very much appreciated.. HELP! :confused:
 
OK, I've installed memcached now..

[/QU[root@webs custombuild]# ps aux | grep memcached
root 3118 0.0 0.0 68988 920 ? Ssl 02:26 0:00 memcached -d -u root
root 10768 0.0 0.0 61276 772 pts/0 S+ 02:57 0:00 grep memcached
OTE]

I have changed:

/usr/local/directadmin/custombuild/configure/ap2/configure.php5
/usr/local/directadmin/custombuild/configure/ap1/configure.php5

I have added the extention in there and also did:

./build clean
./build update
./build all d

But it is not showing in the phpinfo, same problem as first poster.

The link in this thread suggests a solution using customappache but I'm using custombuild and really don't know how to proceed.

My website has to be active on new server today otherwise it will be down, please can someone advise me?
 
Last edited:
You should be coping the structure of configure to custom

cp -rfp /usr/local/directadmin/custombuild/configure /usr/local/directadmin/custombuild/custom

Then edit the files you need.

Also make sure if you use suphp to edit the files in the suphp folder.
 
Back
Top