Home >Operation and Maintenance >CentOS >centos system apache does not parse php

centos system apache does not parse php

王林
王林Original
2020-03-16 19:36:463921browse

centos system apache does not parse php

1. After installing apache in yum, you must install the dependency package httpd-devel, otherwise the file apxs does not exist, and the path of apxs needs to be configured when compiling php

yum install httpdyum install httpd-devel

2. Check the path where apsx is located

rpm -ql httpd-devel|grep apxs/usr/bin/apxs //此行为 grep 结果,不同系统的路径可能不同,以实际结果为准,下同
/sur/share/man/man1/apxs.1.gz  

(Recommended tutorial: centos usage tutorial)

3. When compiling php, add the apxs path parameter to promote generation libphp5.so

./configure \--with-apxs2=/usr/bin/apxs

4. Installation

make && make install

5. Configure service, start service, environment variables

6. Modify apache configuration file, apache2 under Centos7.4. The configuration file path of 4 is

vim /etc/httpd/conf/httpd.conf
//在LoadModule后面添加:LoadModule php5_module modules/libphp5.so //不添加则访问.php文件将会变成下载
//在DirectoryIndex后面添加:index.php
//在AddType application/x-gzip .gz .tgz后面添加:AddType application/x-httpd-php .php //.php前面有一个空格

7. Restart the service

Related video tutorial recommendations: linux video tutorial

The above is the detailed content of centos system apache does not parse php. 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