Apache and PHP Combine
Configuring HTTPD support PHP
Modify the configuration document
Vim/usr/local/apache2.4/conf/httpd.conf
The first step:
Cancel Comment
ServerName www.example.com:80
Step Two:
Change require all denied to require all granted
<Directory /> AllowOverride none Require all granted</Directory>
Step Three:
Add a line AddType application/x-httpd-php. php
AddType application/x-compress .Z AddType application/x-gzip .gz .tgz AddType application/x-httpd-php .php
Fourth Step:
Add Index page index.php
Add an index page after DirectoryIndex index.html index.php
<IfModule dir_module> DirectoryIndex index.html index.php</IfModule>
Configuration effective check for configuration file httpd.cnf syntax is correct
/usr/local/apache2.4/bin/apachectl -t
Reload the configuration file
/usr/local/apache2.4/bin/apachectl graceful
Detect if PHP is parsing properly
Create a new PHP file
vi /usr/local/apache2.4/htdocs/1.php代码:<?phpphpinfo();?>
Browser open Access 192.168.188.2/1.php
If the display is a picture table file is normal;
If the code is displayed as an error;
Error checking procedure: 1. Check if PHP module is loaded
/usr/local/apache2.4/bin/apachectl -M
See if there is a php5_module (shared)
If there are no PHP5 modules, check for PHP5 module files libphp5.so
ls /usr/local/apache2.4/modules/libphp5.so
If you have a libphp5.so file, check that the HTTPD.CNF configuration file is loaded
LoadModule php5_module modules/libphp5.so
2. Check if PHP is added
AddType application/x-httpd-php .php
3. Check whether to increase the index page index.php
DirectoryIndex index.html index.php
Apache and PHP combined (configuration httpd support PHP)