Earlier to this section, i have talked ’bout how to configure MySQL and Apache. This section is a continued part of the my weblog Configuring Apache php and MySQL, and could be useful for any php configuration. In this section i’m going to talk ’bout php installation according the web application needs. As i have already described default compilation of php doesn’t include some of the modules that could be required for most of the web 2.0 rich applications like for most of the social networking platforms.
The configure options that i have used are basically used in the projects for which i have setup the servers for, the options are mostly used for web2.0 rich applications.
Download php from php.net
tar -zxvf php-version.tar.gz
cd php-version
./configure –prefix=/usr/local –with-mysql –with-apxs2=/usr/local/apache2/bin/apxs –with-xml –enable-bcmath –enable-calendar –with-curl –with-dom –with-dom-xslt –with-dom-exslt –enable-exif –with-swf=/usr/local/flash –enable-ftp –with-gd –with-jpeg-dir=/usr –with-png-dir=/usr/local/lib –with-xpm –enable-magic-quotes –with-openssl –enable-discard-path –with-pear –enable-sockets –enable-track-vars –with-xmlrpc –with-zip-dir=/usr/local/lib –with-zlib-dir=/usr/local/lib –enable-soap –with-xsl
NOTE : Add –enable-maintainer- zts, if you have chosen your apache to run with worker mpm.
make test
make install
cp php.ini-dist /usr/local/lib/php.ini
vi /usr/local/apache2/conf/httpd.conf
Add following lines
===================================
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
===================================
Now check your LAMP configuration by creating a file lets say phpinfo.php in apache root dir
vi /usr/local/apache2/htdocs/phpinfo.php and paste following lines
============
<?
phpinfo();
?>
============
Now restart your apache by command
apachectl restart
Open your browser and browse last created page phpinfo.php, you must see page like shown below.