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

What should I do if apache php cannot be parsed?

藏色散人
Release: 2023-03-02 11:32:01
Original
4074 people have browsed it

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
Copy after login

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

“AddType application/x-httpd-php .php”
Copy after login

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

“DirectoryIndex index.html index.htm index.php”
Copy after login

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

“ServerName localhost:80” 保存后退
Copy after login

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        //编译加载所有模块
Copy after login

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!

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