I know this have been written about a billion times, now it’s 1 billion + 1. This is more for a ref for me…
Grab latest apache/php.
1). Compile apache
./configure –prefix=/usr/local/apache2 –enable-so –with-ssl –with-zlib
make; make install
Start apache and then stop apache. Make sure its’ all golden..
2) php time
‘./configure’ ‘–prefix=/usr/local/php5’ ‘–with-apxs2=/usr/local/apache2/bin/apxs’ ‘–with-mysql’ ‘–with-pear’ ‘–with-openssl’ ‘–with-xml’ ‘–enable-bcmath’ ‘–enable-calendar’ ‘–with-curl’ ‘–enable-ftp’ ‘–with-gd’ ‘–enable-sockets’ ‘–enable-track-vars’ ‘–enable-versioning’ ‘–with-zlib’ ‘–enable-magic-quotes’ ‘–with-freetype’ ‘–enable-mbstring’ ‘–with-db4=/usr’ ‘–with-ldap=/usr’ ‘–with-libxml-dir=/usr’ ‘–with-snmp=/usr’ ‘–enable-soap’ ‘–enable-zip’ ‘–with-imap-ssl=/usr’ ‘–with-imap’ ‘–with-kerberos''--with-gettext=shared
‘
Adding gettext, it’s needed for phpldapadmin.
Linux users that compile PHP --with-gettext=shared should include
extension=gettext.so
in your /etc/php.ini
Was interesting with imap and kerberos, as the linkers were getting confused between the 32bit and x64 libs which was causing issues with the libc-client.a lib. Ended up installing the libc-client.a x64 version then just symlinking to the /usr/lib
ln -s /usr/lib64/libc-client.a /usr/lib/
After that it may error out one more time on the ./configure, just install pam-devel with that it will also install a bunch of more *devel stuff, do it. Configure should finally finish..
make; make test
(takes a while…make test not necessary)
make install
3).. If you forget something in PHP and need to re-compile.  You re-run ;  make clean; re-run ./configure with all w/ options; make; make install.   Then just restart apache that should enable whatever you just compile in.
4). cp php.ini-development /usr/local/lib/php.ini
5). vi httpd.conf add
1 2 3 |
LoadModule php5_module modules/libphp5.so # allow ONLY .php .php2-6 to execute php |
1 2 3 |
<FilesMatch "\.ph(p[2-6]?|tml)$"> SetHandler application/x-httpd-php </FilesMatch> |
1 2 3 |
<FilesMatch "\.phps$"> SetHandler application/x-httpd-php-source </FilesMatch> |
1 2 |
RewriteEngine On RewriteRule (.*\.php)s$ $1 [H=application/x-httpd-php-source] |
6). restart apache. that’s it. test via phpinfo.php
phpinfo.php
<?php
phpinfo();
?>