dismiss Step into the future! Click here to switch to the beta php.net site
downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

Problems?> <php-config
[edit] Last updated: Fri, 28 Jun 2013

view this page in

Compiling PECL extensions statically into PHP

You might find that you need to build a PECL extension statically into your PHP binary. To do this, you'll need to place the extension source under the php-src/ext/ directory and tell the PHP build system to regenerate its configure script.

$ cd /your/phpsrcdir/ext
$ pecl download extname
$ gzip -d < extname.tgz | tar -xvf -
$ mv extname-x.x.x extname

This will result in the following directory:


/your/phpsrcdir/ext/extname

From here, force PHP to rebuild the configure script, and then build PHP as normal:


$ cd /your/phpsrcdir
$ rm configure
$ ./buildconf --force
$ ./configure --help
$ ./configure --with-extname --enable-someotherext --with-foobar
$ make
$ make install

Note: To run the 'buildconf' script you need autoconf 2.13 and automake 1.4+ (newer versions of autoconf may work, but are not supported).

Whether --enable-extname or --with-extname is used depends on the extension. Typically an extension that does not require external libraries uses --enable. To be sure, run the following after buildconf:


$ ./configure --help | grep extname



add a note add a note User Contributed Notes Compiling PECL extensions statically into PHP - [2 notes]
up
1
anthon at piwik dot org
10 months ago
Some extensions cannot be statically linked (e.g., xdebug).
up
-1
denis_truffaut a t hotmail d o t com
1 year ago
A tip that could save your time : Don't forget to erase the cache beforce forcing buildconf...

sudo rm -f configure autom4te.cache
sudo ./buildconf --force

 
show source | credits | stats | sitemap | contact | advertising | mirror sites