Build the Environment:
Ubuntu 15.04
Apache 2.4.16
PHP 5.6.15
1 Installing Apache
Install dependent programs (all installed in the/usr/local/directory)
Apr-1.5.2.tar.gz http://apr.apache.org/download.cgi
Apr-util-1.5.4.tar.gz
Pcre-8.37.tar.gz http://www.pcre.org/
Then install Apache
Httpd-2.4.16.tar.gz Http://httpd.apache.org/download.cgi#apache24
./configure--prefix=/usr/local/apache2/--with-apr=/usr/local/apr/--with-apr-util=/usr/local/apr-util/-- With-pcre=/usr/local/pcre/
2 Installing PHP
You may need to install LIBXML2 and Libxml2-dev First, apt-get command installation
Install PHP http://php.net/downloads.php
./configure--prefix=/usr/local/php5--with-apxs2=/usr/local/apache2/bin/apxs--with-config-file-path=/usr/ Local/php5/etc
Configuration file: sudo cp Php.ini-production/usr/local/php5/etc/php.ini
3 Configuring Apache
Enables Apache to parse PHP scripts
sudo vi/usr/local/apache2/conf/httpd.conf
Add to:
addtype application/x-httpd-php. php. phtml
Optional:
LoadModule Php5_module modules/libphp5.so #安装php时候自动添加的
DirectoryIndex index.php index.html #默认打开文件名
DocumentRoot "/usr/local/apache2/htdocs" #默认脚本存放目录, can be modified, and the following <directory "..." > Synchronous modification
4 Testing
Create a info.php file in the/usr/local/apache2/htdocs/directory
<? PHP Phpinfo ();? >
Open Apache Service Sudo/usr/local/apache2/bin/apachectl start
Browser input localhost/info.php appears in PHP information page, indicating that the configuration is successful ~
Linux + Apache + PHP Environment setup