<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Compiling PECL extensions statically into PHP</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="install.pecl.php-config.html">php-config</a></div> <div class="next" style="text-align: right; float: right;"><a href="install.problems.html">Problems?</a></div> <div class="up"><a href="install.pecl.html">Installation of PECL extensions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="install.pecl.static" class="sect1"> <h2 class="title">Compiling PECL extensions statically into PHP</h2> <p class="simpara"> 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 <var class="filename">php-src/ext/</var> directory and tell the PHP build system to regenerate its configure script. </p> <p class="para"> <div class="example-contents screen"> <div class="cdata"><pre> $ cd /your/phpsrcdir/ext $ pecl download extname $ gzip -d < extname.tgz | tar -xvf - $ mv extname-x.x.x extname </pre></div> </div> </p> <p class="simpara"> This will result in the following directory: </p> <p class="para"> <div class="example-contents screen"><br /> /your/phpsrcdir/ext/extname<br /> </div> </p> <p class="simpara"> From here, force PHP to rebuild the configure script, and then build PHP as normal: </p> <p class="para"> <div class="example-contents screen"><br /> $ cd /your/phpsrcdir <br /> $ rm configure<br /> $ ./buildconf --force<br /> $ ./configure --help<br /> $ ./configure --with-extname --enable-someotherext --with-foobar<br /> $ make<br /> $ make install<br /> </div> </p> <blockquote class="note"><p><strong class="note">Note</strong>: <span class="simpara"> To run the 'buildconf' script you need autoconf 2.13 and automake 1.4+ (newer versions of autoconf may work, but are not supported). </span> </p></blockquote> <p class="simpara"> Whether <em>--enable-extname</em> or <em>--with-extname </em> is used depends on the extension. Typically an extension that does not require external libraries uses <em>--enable</em>. To be sure, run the following after buildconf: </p> <p class="para"> <div class="example-contents screen"><br /> $ ./configure --help | grep extname<br /> </div> </p> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="install.pecl.php-config.html">php-config</a></div> <div class="next" style="text-align: right; float: right;"><a href="install.problems.html">Problems?</a></div> <div class="up"><a href="install.pecl.html">Installation of PECL extensions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>