What to do if the php file is not parsed in CentOS
Problems: When accessing the .php file, it will be downloaded by default, or it will prompt " File not found.”
The solution is as follows:
1. Prerequisite
nginx has been installed and can be accessed
2. Analyze whether php-fpm is installed
You can run the command service php-fpm start. If it shows that it cannot be recognized, it means it is not installed
Recommended learning: laravel tutorial
3. If php-fpm
is not installed, you can execute the installation command: yum install php-fpm and then run Command service php-fpm start
4. If php-fpm has been installed and the .php file still cannot be parsed, nginx needs to be set
(1). Modification nginx.conf file or default.conf, as shown in the figure below, modify several pieces of information. For example, "root" refers to my nginx root directory, which can be configured according to your own situation
(2). Save the file and restart nginx, command: service nginx restart
(3). At this point, the browser can access the .php file (if it is not accessed locally, be sure to turn off the firewall)
This article comes from the PHP Chinese website, CentOS usage tutorial column, please pay attention to this column for more related tutorials!
The above is the detailed content of What to do if php files are not parsed in CentOS. For more information, please follow other related articles on the PHP Chinese website!