How to add custom PHP versions in Plesk for Ubuntu / Debian?

Ubuntu server
  1. Connect to the server via SSH
  2. Install the software-properties-common package to manage repositories:

    apt-get install software-properties-common

  3. Add PPA repository:

    add-apt-repository ppa:ondrej/php

  4. Install PHP 7.2:

    apt -y install php7.2

  5. Install necessary PHP modules, here’s an example:

    apt install -y php7.2-{bcmath,bz2,cli,common,curl,dev,fpm,gd,gmp,imagick,imap,intl,json,mbstring,mysql,opcache,soap,ssh2,xml,xmlrpc,zip}

  6. Register PHP handler in Plesk:

    plesk bin php_handler –add -displayname php72-fpm-custom -path /usr/sbin/php-fpm7.2 -phpini /etc/php/7.2/fpm/php.ini -type fpm -id php72-fpm-custom -clipath /usr/bin/php -service php7.2-fpm -poold /etc/php/7.2/fpm/pool.d


Debian server
  1. Connect to the server via SSH
  2. Install the software needed to manage repositories:

    apt install ca-certificates apt-transport-https -y

  3. Add the needed GPG key for the repository:

    wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg

  4. Add the repository URL to a separate APT sources list file:

    sh -c ‘echo “deb https://packages.sury.org/php/ $(lsb_release -sc) main” >> /etc/apt/sources.list.d/php_custom.list’

  5. Refresh the APT sources

    apt update

  6. Install PHP 7.2:

    apt -y install php7.2

  7. Install necessary PHP modules, here’s an example:

    apt install -y php7.2-{bcmath,bz2,cli,common,curl,dev,fpm,gd,gmp,imagick,imap,intl,json,mbstring,mysql,opcache,soap,ssh2,xml,xmlrpc,zip}

  8. Register PHP handler in Plesk:

    plesk bin php_handler –add -displayname php72-fpm-custom -path /usr/sbin/php-fpm7.2 -phpini /etc/php/7.2/fpm/php.ini -type fpm -id php72-fpm-custom -clipath /usr/bin/php7.2 -service php7.2-fpm -poold /etc/php/7.2/fpm/pool.d

 

Reread PHP handlers

plesk bin php_handler –reread

 

Senza categoria

Comments are disabled.