We use cookies
We use cookies to optimize our website. By continuing to browse the site, you agree to our use of cookies.
Control panel
  • Русский
  • Українська
  • English
  • UAH
  • USD
  • RUB
  • EUR
  • 0-800-307-307 Hotline
  • +38 (044) 392-74-33 Kiev
  • +38 (057) 728-39-00 Kharkiv
  • +38 (056) 794-38-31 Dnipro
  • +38 (032) 229-58-93 Lviv
  • +38 (048) 738-57-70 Odessa
  • +38(093) 170-15-42  Life
  • +38 (067) 400-88-44 Kievstar
  • +1(888)393-24-51  USA, Toll free
  • +44(131)507-01-14  Great Britain
  • +7 (499) 348-28-61 Moscow

2.8.6. Changing PHP version in the console

Attention!

Changing PHP version to PHP settings does not affect PHP version in console.

Command to view current PHP version:

php -v

There are several ways to work in the console with a specific PHP version:

To change PHP version through the control panel, do the following:
  1. Open the section "Hosting → Linux configuration»:
  2. In the block "PHP version»Select the required version:
  3. Click "Save».
  4. Run the command source ~/.bashrc or . ~/.bashrc, or just reconnect via SSH.

The installed version will be valid for all new SSH connections.

When executing commands, explicitly specify the path to the PHP interpreter of the required version:
/usr/local/php4/bin/php
/usr/local/php52/bin/php
/usr/local/php53/bin/php
/usr/local/php54/bin/php
/usr/local/php55/bin/php
/usr/local/php56/bin/php
/usr/local/php70/bin/php
/usr/local/php71/bin/php
/usr/local/php72/bin/php
/usr/local/php73/bin/php
/usr/local/php74/bin/php
/usr/local/php80/bin/php

Attention!

To work with Composer use the method with version change via control panel or overriding PATH... Also, aliases are not suitable for use in PHP scripts, Bash scripts and cron - be sure to indicate the full the absolute path to the PHP interpreter the version you want.

To create an alias for the required PHP version through the control panel, do the following:

  1. Open the section "Hosting → Linux configuration»:
  2. In the block "Aliases»In the first field specify php, in the second - the command /usr/local/php80/bin/php (in the command, replace php80 to the required PHP version):
  3. Click "Save».
  4. Run the command source ~/.bashrc or . ~/.bashrc, or just reconnect via SSH.
Override variable PATHby running the command (in the command, replace php80 to the required PHP version):
export PATH=/usr/local/php80/bin:$PATH

The installed version will only work for the current SSH connection. To make the version work for new connections, use the method with version change via control panel.