Add new php-handler in Plesk
List php modes form command line:
/usr/local/psa/admin/sbin/php_handlers_control -list
From Mysql:
select * from psa.ServiceNodeEnvironment where section=’phphandlers’
Select php mode from the plesk database aligned with domain and site catalogue:
select h.php_handler_id,d.name, h.www_root from hosting h join domains d on h.dom_id = d.id
Other option:
mysql -uadmin -p$(cat /etc/psa/.psa.shadow) psa -e "select dom_id,www_root,php_handler_id,php from hosting;" | while read HOSTING; do
DOMAIN=$(echo ${HOSTING} | awk '{print $2}' | awk -F'/' '{print $5}');
HANDLERID=$(echo ${HOSTING} | awk '{print $3}');
PHPVERSION=$(/usr/local/psa/bin/php_handler --list | grep ${HANDLERID} | awk "{if (\$1 == \"${HANDLERID}\") {print \$3}}");
echo "${DOMAIN} - ${HANDLERID} - ${PHPVERSION}";
done
Assign handler to domain:
/usr/local/psa/bin/domain -u **domain_name** -php_handler_id plesk-php54-fpm
Add new:
/usr/local/psa/bin/php_handler --add -displayname <NN> -path <path to php cgi> -clipath <path to php-cli> -phpini <path to php.ini> -type <php handler> -id <NN-custom>
- **displayname
** is the PHP version name that will be shown in the Plesk interface. We recommend you to include the version number in the displayname. For example, you could name the version `5.6.3-custom`. - path <path/to/php/cgi> is the location of the PHP CGI binary file. You can find this in the output of the
make installcommand in theInstalling PHP CGI binaryline. For example, if you see the following in theInstalling PHP CGI binaryline: /usr/local/php563-cgi/bin/, the location you need to specify is /usr/local/php563-cgi/bin/php-cgi. Learn more at the Official PHP web Site. clipath <path to php-cli>is the location of the php file, for example, /usr/local/php563-cgi/bin/phpphpini <path/to/php.ini>is the location of the php.ini file, for example, /usr/local/php563-cgi/etc/php.ini .- *type
* is the type of PHP handler associated with this version. It can be either ‘cgi’ or ‘fastcgi’. - *id
* is the identifier you will use when referring to this PHP version (for example, when adjusting or removing it).
Example:
/usr/local/psa/bin/php_handler -add -displayname php-5.6.3 -path /usr/local/php563-cgi/bin/php-cgi -clipath /usr/local/php563-cgi/bin/php -phpini /usr/local/php563-cgi/etc/php.ini -type fastcgi -id 2
Re-read handlers:
/usr/local/psa/admin/sbin/php_handlers_control -reread
Sources: