Reprint http://www.cnblogs.com/rainisic/archive/2012/05/23/Apache_PHP_Install.html
Download PHP
Official Download: http://www.php.net/downloads.php
Install PHP
First, make sure that Apache supports the PHP module when compiling the installation, for details please refer to: http://www.cnblogs.com/rainisic/archive/2012/05/23/Linux_Apache2_4_Install.html
Unzip PHP
shell> sudo tar zxvf php-5.4.3.tar.gz/opt/sources
Stop Apache Service
shell> sudo service httpd stop
Configure Install PHP
Shell> cd/opt/sources/php-5.4.3shell> sudo./configure--with-apxs2=/usr/local/apache2/bin/apxs-- with-mysqlshell> sudo makeshell> sudo make install
Configure PHP.ini
shell> sudo cp Php.ini-development/usr/local/lib/php.ini
Edit the httpd.conf file to invoke the PHP module. The path to the right of the LoadModule expression must point to PHP in the system. The make install command above may have done this, but be sure to check it.
LoadModule Php5_module modules/libphp5.so
Tell Apache to parse the specific extension into PHP, for example, let Apache parse the extension. php into PHP. Edit httpd.conf
<filesmatch \.php$> SetHandler application/x-httpd-php</filesmatch>
Start the Apache service test in the usual way.
Install PHP 5.4.3 under Linux (Apache webserver)