# gunzip apache_xxx.tar.gz
# tar -xvf apache_xxx.tar
# gunzip php_xxx.tar.gz
# tar -xvf php_xxx.tar
# cd apache_xxx
# ./configure --prefix=/www --enable-module=so
# make && make install
# cd ../php_xxx
# ./configure --with-mysql --with-apxs=/www/bin/apxs
# make && make install
# cp php.ini-development /usr/local/lib/php.ini
下边的载入可能在PHP安装时已经加入了,需要再次确认一下
# vi /etc/httpd/conf/httpd.conf
> LoadModule php5_module libexec/libphp5.so
> :wq
And in the AddModule section of httpd.conf,somewhere under the ClearModuleList,add this:
# vi /etc/httpd/conf/httpd.conf
> AddModule mod_php5.c
> :wq
# vi /etc/httpd/conf/httpd.conf
> AddType application/x-httpd-php .php .phtml
> AddType application/x-httpd-php-source .phps
> :wq
重启apache,来加载php模块。Ok了!
# gunzip -c apache_1.3.x.tar.gz | tar xf -
# cd apache_1.3.x
# ./configure
# cd ..
# gunzip -c php-5.x.y.tar.gz | tar xf -
# cd php-5.x.y
# ./configure --with-mysql --with-apache=../apache_1.3.x
# make
# make install
# cd ../apache_1.3.x
# ./configure --prefix=/www --activate-module=src/modules/php5/libphp5.a
# make
# make install(第一次安装,或者)
# cp httpd /www/bin/httpd
# cd ../php-5.x.y
# cp php.ini-development /usr/local/lib/php.ini
Edit httpd.conf file and add:
# vi httpd.conf
> AddType application/x-httpd-php .php
# ./configure --with-apxs --with-pgsql
This will create a libphp5.so shared library that is loaded into Apache using a LoadModule line in Apache’s httpd.conf file.The PostgreSQL support is embedded into this library.
# ./configure --with-apxs --with-pgsql=shared
This will create a libphp5.so shared library for Apache,but it will also create a pgsql.so shared library that is loaded into PHP either by using the extension directive in php.ini file or by loading it explicitly in a script using the dl() function.
# ./configure --with-apache=/path/to/apache_source --with-pgsql
This will create a libmodphp5.a library,a mod_php5.c and some accompanying files and copy this into the src/modules/php5 directory in the Apache source tree. Then you compile Apache using --activate-module=src/modules/php5/libphp5.a and the Apache build system will create libphp5.a and link it statically into the httpd binary,so the final result here is a single httpd binary that includes all of 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 will get a pgsql.so shared library that you can load into PHPfrom either the php.ini file or directly suing dl().
# gzip -d httpd-2.x.NN.tar.gz
# tar -xf httpd-2.x.NN.tar
# gunzip php-NN.tar.gz
# tar -xf php-NN.tar
#
# cd httpd-2.x.NN
# ./configure --enable-so
# make
# make install
#
# cd ../php-NN
# ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql
# make
# make install
#
# cp php-ini-development /usr/local/lib/php.ini
# vi /etc/local/apache2/conf/httpd.conf
> LoadModule php5_module modules/libphp5.so
>
> <FilesMatch \.php$>
> SetHandler application/x-httpd-php
> </FilesMatch>
>
> # Or,if we wanted to allow .php, .php2, .php3, .php4, .php5, .php6 and .phtml files to be executed as PHP,but nothing
> # else,we’d use this:
> <FilesMatch “\.ph(p[2-6]?|tml)$”>
> SetHandler application/x-httpd-php
> </FilesMatch>
>
> # And to allow .phps files to be handled by the php source filter,and displayed as syntax-highlighted source code,
> # use this:
> <FileMatch “\.phps$”>
> SetHandler application/x-httpd-php-source
> </FileMatch>
>
>
>
> :wq
#
# gunzip apache_xxx.tar.gz
# tar -xvf apache_xxx.tar
# gunzip php-xxx.tar.gz
# tar -xvf php-xxx.tar
# cd apache_xxx
# ./configure --prefix=/www --enable-module=so
# make
# make install
#
# cd ../php-xxx
# ./configure --with-mysql --with-apxs=/www/bin/apxs
# make
# make install
#
# cp php.ini-development /usr/local/lib/php.ini
# vi /www/conf/httpd.conf
> LoadModule php5_module libexec/libphp5.so
> AddType application/x-httpd-php .php .phtml
>
> :wq
And in the Addmodule section of httpd.conf,somewhere under the ClearModuleList,add this:
> AddModule mod_php5.c
#
# gunzip -c apache_1.3.x.tar.gz | tar xf -
# cd apache_1.3.x
# ./configure
# cd ..
#
#
# gunzip -c php-5.x.y.tar.gz | tar xf -
# cd php-5.x.y
# ./configure --with-mysql --with-apache=../apache_1.3.x
# make
# make install
#
# cd ../apache_1.3.x
# ./configure --prefix=/www --activate-module=src/modules/php5/libphp5.a
# make
# make install
#
# cd ../php-5.x.y
# cp php.ini-development /usr/local/lib/php.ini
#
# ./configure --with-apxs --with-pgsql
# ./configure --with-apxs --with-pgsql=shared
# ./configure --with-apache=/path/to/apache_source --with-pgsql
# ./configure --with-apache=/path/to/apache_source --with-pgsql=shared
# ./configure --with-apxs --with-pgsql
This will create a libphp5.so shared library that is loaded into Apache using a LoadModule line in Apache’s httpd.conf file.The PostgreSQL support is embedded into this library.
# ./configure --with-apxs --with-pgsql=shared
This will create a libphp5.so shared library for Apache,but it will also create a pgsql.so shared library that is loaded into PHP either by using the extension directive in php.ini file or by loading it explicitly in a script using the dl() function.
# ./configure --with-apache=/path/to/apache_source --with-pgsql
This will create a libmodphp5.a library,a mod_php5.c and some accompanying files and copy this into the src/modules/php5 directory in the Apache source tree.Then you compile Apache using --activate-modules=src/modules/php5/libphp5.a and the Apache build system will create libphp5.a and link it statically into the httpd binary.The PostgreSQL support is included directly into this httpd binary,so the final result here is a single httpd binary that includes all of 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 will get a pgsql.so shared library that you can load into PHP from either the php.ini file or directly using dl() function.
<?php
Phpinfo();
?>
====================
测试http服务
# lynx localhost
# lynx http://172.16.180.220/libr
本文出自 “小崔的实验笔记” 博客,谢绝转载!