Skip to content
  • Contact us: +34 944 58 06 58
  • Plesk Partner Program
  • Plesk Lifecycle Policy
  • Blog
  • Contact us
  • Plesk 360
  • Contact us: +34 944 58 06 58
  • Plesk Partner Program
  • Plesk Lifecycle Policy
  • Blog
  • Contact us
  • Plesk 360
  • Solutions
    By Role
    • Developers
    • Content Managers
    • Digital Agencies
    • IT Admins
    • Web Hosters
    • Hyperscalers
    • Developers
    • Content Managers
    • Digital Agencies
    • IT Admins
    • Web Hosters
    • Hyperscalers
    By Edition
    • Web Admin Edition
    • Web Pro Edition
    • Web Host Edition
    • Business & Collaboration
    • Plesk WP Edition
    • Web Admin Edition
    • Web Pro Edition
    • Web Host Edition
    • Business & Collaboration
    • Plesk WP Edition
    By Cloud
    • Amazon Web Services
    • Microsoft Azure
    • Alibaba Cloud
    • GCP Marketplace
    • Vultr
    • DigitalOcean
    • Linode
    • UpCloud
    • Amazon Web Services
    • Microsoft Azure
    • Alibaba Cloud
    • GCP Marketplace
    • Vultr
    • DigitalOcean
    • Linode
    • UpCloud
    Partner Program
    Exclusive discounts, benefits and exposure to take your business to the next level
    Become a partner
    • By Role
      • Developers
      • Content Managers
      • Digital Agencies
      • IT Admins
      • Web Hosters
      • Hyperscalers
    • By Edition
      • Web Admin Edition
      • Web Pro Edition
      • Web Host Edition
      • Business & Collaboration
      • WP Edition
    • By Cloud
      • Amazon Web Services
      • Microsoft Azure
      • Alibaba Cloud
      • GCP Marketplace
      • Vultr
      • DigitalOcean
      • Linode
      • UpCloud
    • Partner Program
      • Partner Program
  • Product
    Explore Features
    • Everyone
    • Admins & Web Hosters
    • Developers
    • Designers & Agencies
    • Plesk Features
    • Everyone
    • Admins & Web Hosters
    • Developers
    • Designers & Agencies
    • Plesk Features
    Key Topics
    • SocialBee
    • WP Toolkit
    • Sitejet Builder
    • SEO Toolkit
    • Joomla! Toolkit
    • Plesk Premium Email
    • Plesk Email Security
    • SocialBee
    • WP Toolkit
    • Sitejet Builder
    • SEO Toolkit
    • Joomla! Toolkit
    • Plesk Premium Email
    • Plesk Email Security
    Feature Packs
    • Business & Collaboration
    • WP Pack
    • Hosting Pack
    • Power Pack
    • Language Pack
    • Business & Collaboration
    • WP Pack
    • Hosting Pack
    • Power Pack
    • Language Pack
    Featured Extension
    SocialBee
    • Explore Features
      • Everyone
      • Admins & Web Hosters
      • Developers
      • Designers & Agencies
      • Plesk Features
    • Key Topics
      • SocialBee
      • WP Toolkit
      • Sitejet Builder for Plesk
      • SEO Toolkit
      • Plesk Premium Email
      • Plesk Email Security
    • Feature Packs
      • Business & Collaboration
      • WP Pack
      • Hosting Pack
      • Power Pack
      • Language Pack
    • Featured Extension
      • Extension
  • Pricing
  • Extensions
  • Help Center
  • More
    • Careers
    • Events
    • Plesk University
  • FREE TRIAL
  • Solutions
    • By Role
      • Developers
      • Content Managers
      • Digital Agencies
      • IT Admins
      • Web Hosters
      • Hyperscalers
    • By Edition
      • Web Admin Edition
      • Web Pro Edition
      • Web Host Edition
      • Business & Collaboration
      • WP Edition
    • By Cloud
      • Amazon Web Services
      • Microsoft Azure
      • Alibaba Cloud
      • GCP Marketplace
      • Vultr
      • DigitalOcean
      • Linode
      • UpCloud
    • Partner Program
      • Partner Program
  • Product
    • Explore Features
      • Everyone
      • Admins & Web Hosters
      • Developers
      • Designers & Agencies
      • Plesk Features
    • Key Topics
      • SocialBee
      • WP Toolkit
      • Sitejet Builder
      • SEO Toolkit
      • Joomla! Toolkit
      • Plesk Premium Email
      • Plesk Email Security
    • Feature Packs
      • Business & Collaboration
      • WP Pack
      • Hosting Pack
      • Power Pack
      • Language Pack
    • Featured Extension
      • SocialBee
  • Pricing
  • Extensions
  • Help center
  • More
    • Careers
    • Events
    • Plesk University
    • Blog
    • Plesk Partner Program
    • Contact Us
  • FREE TRIAL
  • Solutions
    • By Role
      • Developers
      • Content Managers
      • Digital Agencies
      • IT Admins
      • Web Hosters
      • Hyperscalers
    • By Edition
      • Web Admin Edition
      • Web Pro Edition
      • Web Host Edition
      • Business & Collaboration
      • WP Edition
    • By Cloud
      • Amazon Web Services
      • Microsoft Azure
      • Alibaba Cloud
      • GCP Marketplace
      • Vultr
      • DigitalOcean
      • Linode
      • UpCloud
    • Partner Program
      • Partner Program
  • Product
    • Explore Features
      • Everyone
      • Admins & Web Hosters
      • Developers
      • Designers & Agencies
      • Plesk Features
    • Key Topics
      • SocialBee
      • WP Toolkit
      • Sitejet Builder
      • SEO Toolkit
      • Joomla! Toolkit
      • Plesk Premium Email
      • Plesk Email Security
    • Feature Packs
      • Business & Collaboration
      • WP Pack
      • Hosting Pack
      • Power Pack
      • Language Pack
    • Featured Extension
      • SocialBee
  • Pricing
  • Extensions
  • Help center
  • More
    • Careers
    • Events
    • Plesk University
    • Blog
    • Plesk Partner Program
    • Contact Us
  • FREE TRIAL

Knowledge Base

How to configure a specific command line PHP version for an SSH user on a Plesk for Linux server?

 
chrootcloudlinuxdomainsgohosting

Question

How to configure a specific command line PHP version for an SSH user on a Plesk for Linux server?

Answer

Note: To apply the solution described in this article it's required to connect to the server with the root user. If root access is not available via SSH, contact your hosting service provider.

By default, the php command calls the binary installed by the PHP version provided by the operating system repository. The binary path of the php command can be retrieved with the following command:

# which php
/usr/bin/php

Alternatively, it's possible to install other PHP versions from Plesk, and to execute those on the command line it's required to call the full binary path. For example:

# /opt/plesk/php/7.4/bin/php -v
PHP 7.4.11 (cli) (built: Oct 2 2020 14:09:37) ( NTS )

All binaries from the additional Plesk PHP versions installed on the server can be retrieved with the following command:

# find /opt/plesk/php/*/bin/php

 

To modify the PHP binary called by the php command for a Plesk system user, apply one of the following options according to the SSH option configured on the subscription:

Click on a section to expand

Subscriptions configured with a chrooted environment

  1. Log in to Plesk GUI as Plesk Administrator

  2. Go to Domains > example.com > Web Hosting Access and set option Access to the server over SSH to /bin/bash (chrooted) > OK to apply the changes

  3. Connect to the server via SSH with the root user

  4. Add the necessary PHP version into the chroot template

  5. Create a symlink with the relative path:

    # ln -s /opt/plesk/php/7.4/bin/php /var/www/vhosts/chroot/bin/php

  6. Apply chroot template to all the subscriptions:

    # ./update_chroot.sh --apply all

  7. Switch to the Plesk system user of the subscription:

    # su example_user

  8. Verify the PHP version running the following command:

    # bash-4.2$ php -v
    PHP 7.4.11 (cli) (built: Oct 2 2020 14:09:37) ( NTS )

    Note: If CageFS is enabled for user on CloudLinux OS, it is required to add PHP to CageFS instead

Subscriptions configured with a non-chrooted environment

  1. Log in to Plesk GUI as Plesk Administrator

  2. Go to Domains > example.com > Web Hosting Access and set option Access to the server over SSH to /bin/bash > OK to apply the changes

  3. Connect to the server via SSH with the root user

  4. Switch to the Plesk system user of the subscription:

    # su example_user

  5. Add the PHP binary path on the .bashrc file:

    # echo "alias php='/opt/plesk/php/7.4/bin/php'" >> ~/.bashrc

    * Where /opt/plesk/php/7.4/bin/php is the necessary PHP binary path

  6. Add the following content to the .bash_profile file:

    # echo "if [ -f ~/.bashrc ]; then" >> ~/.bash_profile
    # echo ". ~/.bashrc" >> ~/.bash_profile
    # echo "fi" >> ~/.bash_profile

  7. Log out to reload the changes:

    # exit

  8. Verify the PHP version running the following command:

    # su example_user
    # php -v
    PHP 7.4.11 (cli) (built: Oct 2 2020 14:09:37) ( NTS )

Tweet
Share
Share
Email
0 Shares
Read the full article
Related Posts

Securing the WordPress Frontier with WP Guardian

Read More »

Introducing WP Guardian Vulnerability Protection: Now available for WP Toolkit

Read More »

How to Host a Go App on Plesk

Read More »
Knowledge Base

On Plesk for Linux server, curl command in chrooted shell or in scheduled task fails: curl: (77) error setting certificate verify locations

Read More »

How to install / remove additional PHP versions provided by Plesk

Read More »

 How to install ‘sqlsrv’ extension for Plesk PHP handlers?

Read More »

Chrooted directories are created in subscription directory on Plesk for Linux server even if SSH access for subscription is forbidden

Read More »

Hosting Wiki

  • Django
  • Cross Site Request Forgery (CSRF)
  • Cross-Origin Resource Sharing (CORS)
  • Server Redundancy
  • Postfix
  • Linux Containers
  • Google Cloud CDN
  • PostgreSQL
  • DDoS
  • Bare Metal Server
  • PhpMyAdmin
  • phpPgAdmin
  • Oracle VM Server
  • Server Virtualization Software
  • Windows Server
  • Linux
  • PHP
  • MongoDB
  • Domain
  • Hosting Control Panel
  • Plesk
  • NoSQL Database
  • Web Server
  • DNS Server
  • SSH
  • Colocation Hosting
  • Reseller Hosting
  • Cloud Hosting
  • VPS Hosting
  • Dedicated Hosting
  • Shared Hosting
  • Free Hosting
  • Managed Hosting

Industry
Partners

industry-partner_ALIBABA
industry-partner_GOOGLEPARTNER
industry-partner_MICROSOFT
industry-partner_REDHAT-r2
industry-partner_ALIBABA
industry-partner_AUTOMATTIC
industry-partner_AWS
industry-partner_DIGITALOCEAN
industry-partner_SCALEWAY
Follow us:
Facebook Twitter Linkedin Youtube Github

COMPANY

About Plesk
Our Brand
Legal
Careers
Impressum

PRODUCT

Pricing 
Extensions
What’s new

KNOWLEDGE BASE

Documentation
Help Center
Migrate to Plesk
Contact Us
Hosting Wiki
Preview releases

PROGRAMS

Contributor Program NEW
Partner Program
Affiliate ProgramNEW

COMMUNITY

Blog
Forums 
Plesk University

First defaul

Company

About Plesk
Our Brand
Legal
Careers
Impressum

PRODUCT

Pricing 
Extensions
What’s new

KNOWLEDGE BASE​

Documentation
Help Center
Migrate to Plesk
Contact Us
Hosting Wiki
Preview releases

PROGRAMS​

Contributor Program NEW
Partner Program
Affiliate ProgramNEW

COMMUNITY​

Blog
Forums
Plesk University

Follow us:
Facebook Twitter Linkedin Youtube Github

© 2025 WebPros International GmbH. All rights reserved. Plesk and the Plesk logo are trademarks of WebPros International GmbH.

Managed with love with Plesk WP Toolkit