centos system apache does not parse php

王林
Release: 2020-03-16 19:36:46
Original
3715 people have browsed it

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

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

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

4. Installation

make && make install
Copy after login

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前面有一个空格
Copy after login

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!

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!