Changing the Default PHP CLI Version

This article explains how to change the default PHP CLI binary for an SSH user (system user). Please make sure that the system user is using the /bin/bash shell.



Changing the PHP CLI Version

First, log in via SSH using the relevant SSH user (system user). You can then change the default PHP version using the following command:


echo "export PATH=/opt/plesk/php/8.5/bin:$PATH;" >> ~/.bash_profile

source ~/.bash_profile


You can use the php -v command to verify that the changes have been applied correctly.


ssh_demo@s13311:~$ php -v

PHP 8.5.12 (cli) (built: Oct 21 2026 09:16:14) (NTS)
Copyright (c) The PHP Group
Built by Plesk
Zend Engine v4.5.12, Copyright (c) Zend Technologies
    with Zend OPcache v8.5.12, Copyright (c), by Zend Technologies



Alternative CLI Versions

In addition to PHP 8.2, other PHP versions are also available for the command line. Use the command

plesk bin php_handler --list to display all versions:


 id:  display name:  full version:  version:    type: cgi-bin: php-cli: php.ini:  custom:  status:
            plesk-php82-cgi 8.2.35 8.2.35 8.2 cgi   /opt/plesk/php/8.2/bin/php-cgi  /opt/plesk/php/8.2/bin/php  /opt/plesk/php/8.2/etc/php.ini     true disabled
 plesk-php82-fastcgi 8.2.35 8.2.35 8.2  fastcgi   /opt/plesk/php/8.2/bin/php-cgi  /opt/plesk/php/8.2/bin/php  /opt/plesk/php/8.2/etc/php.ini     true disabled
            plesk-php82-fpm 8.2.35 8.2.35 8.2 fpm  /opt/plesk/php/8.2/sbin/php-fpm  /opt/plesk/php/8.2/bin/php  /opt/plesk/php/8.2/etc/php.ini     true  enabled
  plesk-php82-fpm-dedicated 8.2.35 8.2.35 8.2 fpm  /opt/plesk/php/8.2/sbin/php-fpm  /opt/plesk/php/8.2/bin/php  /opt/plesk/php/8.2/etc/php.ini     true disabled
            plesk-php83-cgi 8.3.36 8.3.36 8.3 cgi   /opt/plesk/php/8.3/bin/php-cgi  /opt/plesk/php/8.3/bin/php  /opt/plesk/php/8.3/etc/php.ini     true disabled
 plesk-php83-fastcgi 8.3.36 8.3.36 8.3  fastcgi   /opt/plesk/php/8.3/bin/php-cgi  /opt/plesk/php/8.3/bin/php  /opt/plesk/php/8.3/etc/php.ini     true disabled
            plesk-php83-fpm 8.3.36 8.3.36 8.3 fpm  /opt/plesk/php/8.3/sbin/php-fpm  /opt/plesk/php/8.3/bin/php  /opt/plesk/php/8.3/etc/php.ini     true  enabled
  plesk-php83-fpm-dedicated 8.3.36 8.3.36 8.3 fpm  /opt/plesk/php/8.3/sbin/php-fpm  /opt/plesk/php/8.3/bin/php  /opt/plesk/php/8.3/etc/php.ini     true disabled
            plesk-php84-cgi 8.4.27 8.4.27 8.4 cgi   /opt/plesk/php/8.4/bin/php-cgi  /opt/plesk/php/8.4/bin/php  /opt/plesk/php/8.4/etc/php.ini     true disabled
 plesk-php84-fastcgi 8.4.27 8.4.27 8.4  fastcgi   /opt/plesk/php/8.4/bin/php-cgi  /opt/plesk/php/8.4/bin/php  /opt/plesk/php/8.4/etc/php.ini     true disabled
            plesk-php84-fpm 8.4.27 8.4.27 8.4 fpm  /opt/plesk/php/8.4/sbin/php-fpm  /opt/plesk/php/8.4/bin/php  /opt/plesk/php/8.4/etc/php.ini     true  enabled
  plesk-php84-fpm-dedicated 8.4.27 8.4.27 8.4 fpm  /opt/plesk/php/8.4/sbin/php-fpm  /opt/plesk/php/8.4/bin/php  /opt/plesk/php/8.4/etc/php.ini     true disabled
            plesk-php85-cgi 8.5.12 8.5.12 8.5 cgi   /opt/plesk/php/8.5/bin/php-cgi  /opt/plesk/php/8.5/bin/php  /opt/plesk/php/8.5/etc/php.ini     true disabled
 plesk-php85-fastcgi 8.5.12 8.5.12 8.5  fastcgi   /opt/plesk/php/8.5/bin/php-cgi  /opt/plesk/php/8.5/bin/php  /opt/plesk/php/8.5/etc/php.ini     true disabled
            plesk-php85-fpm 8.5.12 8.5.12 8.5 fpm  /opt/plesk/php/8.5/sbin/php-fpm  /opt/plesk/php/8.5/bin/php  /opt/plesk/php/8.5/etc/php.ini     true  enabled
  plesk-php85-fpm-dedicated 8.5.12 8.5.12 8.5 fpm  /opt/plesk/php/8.5/sbin/php-fpm  /opt/plesk/php/8.5/bin/php  /opt/plesk/php/8.5/etc/php.ini     true disabled


For example, to use PHP 8.1 as the default binary, you can use the command from Step 2 as follows:


echo "export PATH=/opt/plesk/php/8.5/bin:$PATH;" >> ~/.bash_profile

php -v

PHP 8.5.12 (cli) (built: Oct 21 2026 09:16:14) (NTS)



Common Errors

Error message:

/usr/bin/env: "php": No such file or directory

This error occurs if no default PHP CLI version has been selected. In this case, you can either set the default CLI version or call the PHP binary directly. Example:

/opt/plesk/php/8.5/bin/php [your command]

See also: PHP CLI Versions