Compiling and Installing the SoftwareAfter you've successfully downloaded all the sources, the next step is to configure, compile, and install the different packages. The next sections show you how. Step 1Unpacking the SourcesUnpack all the sources to a temporary area on your system (I'll be using /tmp/sources/).
You should end up with a directory structure that looks something like this:
Step 2Adding the External LibrariesNext, configure, build, and install the external libraries required by PHP. Here's how: Configure, build, and install expat.
Unless you specified a different directory, the expat library should get installed to /usr/local/lib/. ( You can specify a different directory by adding the --prefix to the configure script.)Run the library linker ldconfig to tell the system about the newly installed library.
Configure, build, and install zlib.
Unless you specified a different directory, the zlib library should get installed to /usr/local/lib/. (You can specify a different directory by adding the --prefix to the configure script.)Run the library linker ldconfig to tell the system about the newly installed library.
Configure, build, and install libxml.
Unless you specified a different directory, the libxml library should get installed to /usr/local/lib/. (You can specify a different directory by adding the --prefix to the configure script.)Run the library linker ldconfig to tell the system about the newly installed library.
Configure, build, and install Sablotron.
Unless you specified a different directory, the Sablotron library should get installed to /usr/local/lib. (You can specify a different directory by adding the --prefix to the configure script.)Run the library linker ldconfig to tell the system about the newly installed library.
Step 3Adding PHPAfter all the external libraries have been built and installed, it's time to configure, build, and install PHP. Here's how (do one of the following): If you want to compile PHP as a module into the Apache web server, you need to first configure it appropriately. To do this, first change into the Apache directory and run Apache's configuration script. This is a necessary precondition to compiling PHP as an Apache module because it tells PHP where to find Apache's header files.Now, move back to the PHP directory, and configure PHP with support for all required XML extensions. You should now have a PHP module suitable for use with the Apache web server. This module should have been copied automatically into the Apache source tree.
If you want to compile a standalone PHP binary, you don't need to bring Apache into the picture at all. Simply change into your PHP directory and run the configure script with the following options: You should now have a PHP binary installed to /usr/local/bin/, which can be used to execute any PHP script from the command line. Skip the following steps and proceed directly to the section titled "Testing the Software" to verify that your PHP build has support for all the required extensions. Step 4Adding ApacheIf you decided to compile PHP as an Apache module, the next step is to compile and install Apache. Move back into the Apache directory, configure Apache to use the PHP module created in the first choice of "Step 3Adding PHP," and build and install it.
Step 5Configuring Apache to Work with PHPAfter Apache has been installed, open up Apache's configuration file, httpd.conf, in your favorite text editor, and add the following lines to it so that Apache knows how to handle files with the .php extension:
Step 6Starting ApacheStart the Apache web server via the included apachectl script.
A Note for Windows UsersThe preceding sections document the process of recompiling PHP with XML support on Linux and other UNIX variants. If you're using Windows, most of what you've just read is irrelevant to you. This is because Windows users get a pre-built PHP binary, which already includes support for most common extensions, and they need only to activate these extensions via the Windows php.ini configuration file.The extensions that need to be activated in the php.ini configuration file (look in the section titled "Dynamic Extensions") are the following: php_domxml.dll php_xslt.dll php_sockets.dll You can activate these extensions by removing the semicolon (;) at the beginning of the corresponding line in php.ini. Remember to restart the web server for your changes to take effect.Note that the Windows versions of PHP 4.1.1 and 4.2.0 include built-in support for WDDX, but no support for the XML-RPC extension.For detailed instructions on getting PHP and Apache to talk nicely to each other on the Windows platform, refer to the installation instructions that ship with the Windows version of PHP, or visit the web page at http://www.php.net/manual/en/install.windows.php. |