Home  >  Article  >  Backend Development  >  What should I do if apache php cannot be parsed?

What should I do if apache php cannot be parsed?

藏色散人
藏色散人Original
2020-07-11 09:58:374044browse

The solution to the problem that apache php cannot be parsed: first modify the apache configuration file "httpd.conf"; then add the statement "AddType application/x-httpd-php.php"; finally recompile and install apache.

What should I do if apache php cannot be parsed?

Analysis of Apache unable to parse PHP files

Judgement failure of PHP unable to parse

1 . /usr/local/apache/bin/apachectl -M //Check whether the php5_module (shared) module is loaded;

2. In the /usr/local/apache2/modules/ directory, check whether it is loaded libphp5.so module;

3. Check whether the compiled configuration file is correct: /usr/local/apache2/conf/httpd.conf

Modify the apache configuration file httpd.conf

vim /usr/local/apache2/conf/httpd.conf

Find in httpd.conf: "AddType application/x-gzip .gz .tgz" Add under this line

“AddType application/x-httpd-php .php”

Look again and continue to find: "DirectoryIndex index.html", put Modify this line to

“DirectoryIndex index.html index.htm index.php”

and then find: "#ServerName www.example.com:80" Modify this line to

“ServerName localhost:80” 保存后退

4. Use the command to check whether the main configuration file is correct: / usr/local/apache2/bin/apachectl -t

5. When compiling and installing apache, it is recommended to add two parameters (you will not need to compile again if you use it in the future):

--enable-modes-shared=most        //编译加载最多的模块 
--enalbe-modes-shared=all        //编译加载所有模块

In short After a failure occurs, you must first determine the cause of the problem so that you can deal with it.

For more related knowledge, please visit PHP Chinese website!

The above is the detailed content of What should I do if apache php cannot be parsed?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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