1.
First compile and install apache2 in/home/nouse
2.
Compile php under/home/nouse
. /Configure -- prefix =/home/nouse/php -- with-apxs2 =/home/nouse/apache2/bin/apxs -- with-mysql =/usr/lib64/mysql -- with-curl = /home/curl -- with-config-file-path =/home/php/etc -- enable-ftp -- enable-bz2 -- with-gettext -- enable-calendar -- enable-mbstring -- enable- bcmatch -- enable-sockets -- enable-exif -- enable-soap -- enable-sysvmsg -- enable-wddx -- with-openssl =/usr -- with-gd -- with-jpeg-dir =/ usr -- with-png-dir =/usr -- with-mcrypt =/usr/local/lib -- with-freetype-dir =/usr/local/include -- enable-zip
Note: The parameter locations of prefix and apxs2 must be specified to/home/nouse. This folder does not play a major role in generating libphp. so
3.
Save apache2/modules/libphp5.so
4.
Php for compilation
Parameters except prefix and apxs2 are different. For example
. /Configure -- prefix =/home/php -- with-apxs2 =/usr/bin/apxs2 -- with-mysql =/usr/lib64/mysql -- with-curl =/home/curl -- -config-file-path =/home/php/etc -- enable-ftp -- enable-bz2 -- with-gettext -- enable-calendar -- enable-mbstring -- enable-bcmatch -- enable-sockets -- enable-exif -- enable-soap -- enable-sysvmsg -- enable-wddx -- with-openssl =/usr -- with-gd -- with-jpeg-dir =/usr -- with-png- dir =/usr -- with-mcrypt =/usr/local/lib -- with-freetype-dir =/usr/local/include -- enable-zip
5.
Overwrite libphp. so to/usr/lib/apache2/modules.
6.
Place the php. ini-dist in the php source package under/home/php/etc to load the configuration file.