|
|
Installing PHP as a compiled Apache module with PostgreSQL Support |
Also available as
|
|
I normally perform the following su'd as root unless otherwise noted Note: Requires Apache non-DSO or Apache DSO and PostgreSQL to be already installed Step 1: make the directory, if it does not already exist, to put the tarball and source tree into mkdir /usr/local/src/phpStep 2: get the tarball, either from www.php.net or from a local source download or copy <phpversion>.tar.gz to /usr/local/src/phpStep 3: unzip and untar the tarball cd /usr/local/src/phpthe above will unzip and untar the tarball into the required directory tree Step 4: configure the makefile ready to compile ./configure --with-apache=/usr/local/src/apache/<apacheversion> \with-apache sets Apache support and path to Apache source tree (I think it's the source tree that need to be pointed to, either that or the binary tree which will be /usr/local/apache/<apacheversion>) with-pgsql sets PostgreSQL support and path to PostgreSQL binary tree Step 5: do the compile and the install make && make installStep 6: re-configure the Apache makefile cd /usr/local/src/apache/<version> ./configure --verbose \verbose is enabled just-for-the-hell-of-it prefix defines the base directory to install into, e.g. /usr/local/apache/1.3.11 I also usually add php to the end /usr/local/apache/1.3.11_php enable-module=prefix is again installed just-for-the-hell-of-it, plus it provides lots of extra exciting info when the server is running activate-module=src/modules/php3/libphp3.a activates the PHP module and provides the path to the module Step 7: do the compile and the install again for Apache make && make installStep 8: copy the configuration file on to the target system cd /usr/local/src/php/<phpversion>Step 9: edit httpd.conf cd /usr/local/apache/<apacheversion>/confthe above line is often already entered into httpd.conf but commented out, scan down the file and find it Step 10: restart Apache /usr/local/apache/<apacheversion>/bin/apachectl stop /usr/local/apache/<apacheversion>/bin/apachectl startyou should now have a working Apache server with PHP Step 11: test Apache telnet <hostname> <port>telnet <hostname> <port> where <hostname> is the hostname of the machine Apache & PHP are installed and running on and <port> is the number of the port that Apache is running on, usually 80, but sometime 8080, configurable via httpd.conf |