Analysis idea: PHP is not resolved successfully, resulting in the Web page directly output PHP code.
LAMP:
APACHE: Edit configuration file Add a bit of content
Vim/etc/httpd/conf/httpd.conf
788 rows
AddType application/x-httpd-php. php
AddType application/x-httpd-php. Php-source. php
After saving exits
/ETC/INIT.D/HTTPD restart
Restart Service
LNMP:
After setting up the LNMP environment, enter the local URL and return directly:
<?php
Phpinfo ();
?>
After analysis and troubleshooting, found that the problem lies.
Because it was directly copied over the configuration file, the part of the comment did not cancel the PHP interpretation failed: (because of the first build so that the small white error is embarrassing)
Vi/etc/nginx/conf.d/default.conf #编辑
Location ~ \.php$ {
root HTML;
Fastcgi_pass 127.0.0.1:9000;
Fastcgi_index index.php;
Fastcgi_param script_filename $document _root$fastcgi_script_name;
Include Fastcgi_params;
}
#取消FastCGI the comment for the server section location, and note the parameters of the Fastcgi_param row, and change to $document_root$fastcgi_script_name.
Conclusion: If your web platform is set up to appear 404 Not found or directly return PHP file code, this time should focus on the PHP configuration parsing problem.
This article is from the "90-it Road" blog, please be sure to keep this source http://10528763.blog.51cto.com/10518763/1675538
LAMP/LNMP the code to return the PHP file after the local URL is built.