Home > Backend Development > PHP Problem > How to connect between php and apache

How to connect between php and apache

王林
Release: 2023-02-26 18:08:01
Original
5388 people have browsed it

How to connect between php and apache

Environment check before connection:

php -v
PHP 5.6.30 (cli) (built: Oct 22 2018 21:56:47)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
Copy after login
service apache -v
Server version: Apache/2.4.37 (Unix)
Server built: Oct 26 2018 22:18:18
Copy after login
service php-fpm status
php-fpm (pid 24166) is running...
Copy after login

Start configuration: (mainly modify the httpd.conf file)

Load these two modules in httpd.conf

LoadModule proxy_module modules/mod_proxy.so<br/>LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so

When receiving a php page request, leave it to the php engine for interpretation instead of downloading the page

AddType application/x-httpd-php .php<br/>AddType application/x-httpd-php-source .phps

# Change the default index page of the directory to index.php

DirectoryIndex index.php index.html

# If php-fpm uses TCP socket, then add at the end of httpd.conf:

<FilesMatch \.php$>
SetHandler "proxy:fcgi://127.0.0.1:9000"
</FilesMatch>
Copy after login

Recommended tutorial: PHP video tutorial

The above is the detailed content of How to connect between php and apache. 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