LAMP/LNMP the code to return the PHP file after the local URL is built.

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.