ISPConfig3 Use Multiple PHP Versions

最後更新: 2019-08-22

目錄

  • Install phpX by remi
  • ISPConfig Panel Config
  • Settings
    - 1) 加大 upload size
  • 更改 php 的執行身份

Install phpX by remi

 

https://datahunter.org/remi

 


ISPConfig Panel Config

 

System -> Additional PHP Versions-> Add new PHP version

 * Client should be left blank, unless you want this PHP version to be only available for a specific client

 * Switch to the FastCGI Settings tab (no need to click save, the panel auto saves when moving between tabs).

FastCGI Settings:

  • Path to the PHP FastCGI binary: /opt/remi/php56/root/usr/bin/php-cgi
  • Path to the php.ini directory: /opt/remi/php56/root/etc

PHP-FPM Settings:

  • Path to the PHP-FPM init script: php73-php-fpm
    # systemctl status php73-php-fpm.service
  • Path to the php.ini directory: /etc/opt/remi/php73
    # ls /etc/opt/remi/php73/php.ini
  • Path to the PHP-FRPM pool directory: /etc/opt/remi/php73/php-fpm.d
    # ls /etc/opt/remi/php73/php-fpm.d   www.conf

Troubleshoot

如果設定了網站行 php-fpm 後 Error, 可以順序檢查

[1]

ls /etc/opt/remi/php70/php-fpm.d/

web4.conf  www.conf

[2]

grep listen /etc/opt/remi/php70/php-fpm.d/web4.conf

listen = 127.0.0.1:9013

grep 9013 /etc/httpd/conf/sites-enabled/*

ProxyPassMatch ^/(.*\.php[345]?(/.*)?)$ fcgi://127.0.0.1:9013/var/www/clients/client2/web4/web/$1

netstat -nl | grep 9013

 

Fix php-fpm 沒有 reload

Path to the PHP-FPM ispconfig php script

/usr/local/ispconfig/server/mods-enabled/web_module.inc.php

 

function restartPHP_FPM($action = 'restart') {
    ...
    $initcommand = 'systemctl reload '.$init_script;

$init_script      <-- GUI 填那個

$initcommand  <-- 最終 reload php-fpm 的 cmd: "systemctl reload php-fpm-restart.service"

P.S.

$conf['init_scripts']                        # string(11) "/etc/init.d"

$web_config['php_fpm_init_script'] # string(7) "php-fpm"

 


PHP Settings

 

 

1) 加大 upload size

 

php56 with mod

/opt/remi/php56/root/etc/php.ini

post_max_size=20M
upload_max_filesize=28M

php73 with fpm

/etc/opt/remi/php73/php-fpm.d/www.conf

php_admin_value[upload_max_filesize] = 70M
php_admin_value[post_max_size] = 70M

ISPConfig(php73 with fpm)

Website -> "datahunter.org" -> Options tab -> Custom php.ini settings

upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300
memory_limit = 256M
short_open_tag = On

 


更改 php 的執行身份

 

/usr/local/ispconfig/server/conf/php_fpm_pool.conf.master

 


參考

 

Creative Commons license icon Creative Commons license icon