Ubuntu
Ubuntu:Apache2 未載入 PHP-FPM php.ini
我需要一些關於 Apache2 不載入 php-fpm php.ini 的幫助。我已成功安裝 php-fpm,創建了池和其他配置,但 Apache2 並未將伺服器 API 從更改
Apache 2.0 Handler
為FPM/FastCGI
Apache2 中的 fastcgi.conf
Action php-fcgi-tccuat-72 /php-fcgi-john-72 Alias /php-fcgi-tccuat-72 /usr/lib/cgi-bin/php-fcgi-john-72 FastCgiExternalServer /usr/lib/cgi-bin/php-fcgi-john-72 -socket /run/php-fpm-www-john-72.sock -idle-timeout 360 -pass-header Authorization ... <Directory /usr/lib/cgi-bin> Options ExecCGI FollowSymLinks SetHandler fastcgi-script Require all granted </Directory>
然後在我的虛擬主機條目中添加了一行:
... AddHandler php-fcgi-john-72 .php ...
PHP-FPM 的狀態
systemctl status php7.2-fpm ● php7.2-fpm.service - The PHP 7.2 FastCGI Process Manager Loaded: loaded (/lib/systemd/system/php7.2-fpm.service; enabled; vendor preset: enabled) Active: active (running) since Tue 2020-07-07 08:05:22 NZST; 16min ago Docs: man:php-fpm7.2(8) Process: 923 ExecStartPost=/usr/lib/php/php-fpm-socket-helper install /run/php/php-fpm.sock /etc/php/7.2/fpm/pool.d/www.co Main PID: 854 (php-fpm7.2) Status: "Processes active: 0, idle: 5, Requests: 0, slow: 0, Traffic: 0req/sec" CGroup: /system.slice/php7.2-fpm.service ├─854 php-fpm: master process (/etc/php/7.2/fpm/php-fpm.conf) ├─911 php-fpm: pool www-default-72 ├─912 php-fpm: pool www-john-pub-72 ├─913 php-fpm: pool www-john-72 ├─918 php-fpm: pool www └─922 php-fpm: pool www
PHP資訊:
PHP Version 7.2.31-1+ubuntu16.04.1+deb.sury.org+1 ---------- System: Linux ansible3rd 4.15.0-45-generic #48~16.04.1-Ubuntu SMP Tue Jan 29 18:03:48 UTC 2019 x86_64 Build Date: May 14 2020 08:27:14 Server API: Apache 2.0 Handler Virtual Directory Support: disabled Configuration File (php.ini) Path: /etc/php/7.2/apache2 Loaded Configuration File: /etc/php/7.2/apache2/php.ini Scan this dir for additional .ini files: /etc/php/7.2/apache2/conf.d
我期待的是:
Server API: FPM/FastCGI Virtual Directory Support: disabled Configuration File (php.ini) Path: /etc/php/7.2/fpm Loaded Configuration File: /etc/php/7.2/fpm/php.ini Scan this dir for additional .ini files: /etc/php/7.2/fpm/conf.d
我錯過了什麼?
確保您沒有
libapache2-mod-php
安裝。Apache 報告說它正在使用這個模組而不是 php-fpm。sudo apt purge libapache2-mod-php
然後重啟httpd。
sudo systemctl restart apache2