Apache with PHP
The Apache master configuration file is:/usr/local/apache2/conf/httpd.conf
Vim/usr/local/apache2/conf/httpd.conf
Found it:
AddType application/x-gzip. gz. tgz
Under this line, add the following:
AddType application/x-httpd-php. php
Found it:
<ifmodule dir_module>
DirectoryIndex index.html
</IfModule>
Change the line to read:
<ifmodule dir_module>
DirectoryIndex index.html index.htm index.php
</IfModule>
Found it:
#ServerName www.example.com:80
Modified to:
ServerName localhost:80
Test if lamp is successful
Verify that the configuration file is correct before starting Apache:
/usr/local/apache2/bin/apachectl-t
If there is an error, please continue to modify httpd.conf, if it is correct is displayed as "Syntax OK", the command to start Apache:
/usr/local/apache2/bin/apachectl start
To see if it starts:
[Email protected] ~]# NETSTAT-LNP |grep httpd
TCP 0 0::: +:::* LISTEN 7667/httpd
If this line is displayed, it is started. You can also use the Curl command to simply test:
[[email protected] ~]# curl localhost
This is only true if it is displayed.
Test if PHP is parsed correctly:
vim/usr/local/apache2/htdocs/1.php
Write:
<?php
echo "PHP parsing normal";
?>
After saving, continue testing:
Curl localhost/1.php
See if you can see the following information:
[Email protected] ~]# Curl localhost/1.php
PHP parsing normal [[email protected] ~]#
Only shown as Amin is correct.
You may not be able to access the Web service when you first use it for your browser, because of the firewall. Please run the following command:
[Email protected] ~]# iptables-f
This allows the system to clear the default firewall rules and release port 80.
This article is from the "Wings of Light" blog, please be sure to keep this source http://vanjle.blog.51cto.com/9794584/1871531
Test PHP parsing