Home > Backend Development > PHP Problem > What to do if PHP cannot be parsed in Nginx+PHP environment

What to do if PHP cannot be parsed in Nginx+PHP environment

coldplay.xixi
Release: 2023-03-03 13:44:01
Original
3038 people have browsed it

The solution to the problem that PHP cannot be parsed in the Nginx PHP environment: first open the file and add the relevant code; then restart the nginx service after the modification is completed, the code is [nginx -s reload]; finally re-parse the PHP page. .

What to do if PHP cannot be parsed in Nginx+PHP environment

Solution to PHP failure to parse in Nginx PHP environment:

Change nginx default fastcgiparams configuration file

1. Open the file with the following command

vi /etc/nginx/fastcgi_params
Copy after login

2. Add the following two lines of code at the end of the file

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;  
fastcgi_param PATH_INFO                $fastcgi_script_name;
Copy after login

PS: Note that $document_root is the root directory of the project web page, such as mine The root directory is: /var/www

3. After the modification is completed, restart the nginx service

    nginx -s reload
Copy after login

Finally, re-parse the php page and you can find the problem solved.

Related learning recommendations: PHP programming from entry to proficiency

The above is the detailed content of What to do if PHP cannot be parsed in Nginx+PHP environment. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template