Install the PHP Apache module in detail under UNIX

Source: Internet
Author: User
Tags copy final ini postgresql

Details of installing PHP with Apache on Unix.
You can select arguments to the "Configure on line 8 below" from the Complete list of configure options.

Example 2-4. Installation instructions (Apache Module Version)

1. Gunzip apache_1.3.x.tar.gz
2. Tar xvf Apache_1.3.x.tar
3. Gunzip php-x.x.x.tar.gz
4. Tar xvf Php-x.x.x.tar
5. CD apache_1.3.x
6./configure--prefix=/www
7. cd. /php-x.x.x
8./configure--with-mysql--with-apache=. /apache_1.3.x--enable-track-vars
9. Make
Make install
CD. /apache_1.3.x
For PHP 3:./configure--activate-module=src/modules/php3/libphp3.a
For PHP 4:./configure--activate-module=src/modules/php4/libphp4.a
Make
Make install

Instead of this step you could prefer to simply copy the httpd binary
Overtop of your existing binary. Make sure your shut down your
Server-though.

CD. /php-x.x.x
For PHP 3:CP Php3.ini-dist/usr/local/lib/php3.ini
For PHP 4:CP Php.ini-dist/usr/local/lib/php.ini

Can edit your. ini file to set PHP options. If
You are prefer this file in another location and use
--with-config-file-path=/path in step 8.

Edit your httpd.conf or srm.conf file and add:

For PHP 3:addtype application/x-httpd-php3. php3
for PHP 4:addtype application/x-httpd-php. php

Can choose any extension your wish here. . PHP is simply the one
We suggest. You can even include. html.


Use your normal procedure for starting the Apache server. (You must
Stop and restart the server, not just cause the server to reload by
Use a HUP or USR1 signal.)




Different examples of compiling PHP for Apache are as follows:


./configure--with-apxs--with-pgsql





This'll create a libphp4.so shared library is loaded to Apache using a LoadModule line in Apache ' s httpd.conf fil E. The PostgreSQL support is embedded to this libphp4.so library.



./configure--with-apxs--with-pgsql=shared





This would again create a libphp4.so shared library for Apache, but it'll also create a pgsql.so shared library that is L Oaded into PHP either by using the Extension directive in php.ini file or by loading it explicitly in a script using the D L () function.



./configure--with-apache=/path/to/apache_source--with-pgsql





This'll create a libmodphp4.a library, a mod_php4.c and some accompanying files and copy this into the SRC/MODULES/PHP4 Directory in the Apache source tree. Then you compile Apache using--ACTIVATE-MODULE=SRC/MODULES/PHP4/LIBPHP4.A and the Apache build system'll create LIBPHP4 . A and link it statically into the httpd binary. The PostgreSQL support is included directly to this httpd binary, so the final result are here's a single httpd binary Includes all Apache and all of PHP.



./configure--with-apache=/path/to/apache_source--with-pgsql=shared





Same as before, except instead of including PostgreSQL support directly into the final httpd you'll get a pgsql.so share D library that you can load in PHP from either the php.ini file or directly using DL ().

When choosing to builds PHP in different ways, your should consider the advantages and drawbacks of each method. Building as a shared object would mean that your can compile Apache separately, and Don ' t have to recompile everything as yo U add to, or change, PHP. Building PHP into Apache (static method) means that PHP'll load and run faster. For more information, the "Apache webpage on DSO support."



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.