As part of your hosting account, you can use multiple PHP versions directly from the SSH console. This is particularly useful for:
- Running PHP scripts manually.
- Executing Composer commands.
- Testing application compatibility.
- Running scheduled tasks (cron jobs).
- Using different PHP versions for development and troubleshooting.
Important
The PHP version available in the SSH console is independent of the PHP version configured for your website. Changing the PHP version used in SSH does not affect the PHP version used by your website.
Table of Contents
Enabling SSH Access
Before using PHP from the command line, make sure SSH access is enabled for your account.
In the mybox Panel:
- Navigate to:
Advanced → Secure Shell (SSH)
- Enable SSH access if it is not already active.
- Connect using your preferred SSH client, such as:
- PuTTY
- Termius
- OpenSSH (Linux/macOS)
Available PHP Versions
PHP 5.x
| PHP Version | Command |
|---|---|
| PHP 5.3 | php or php53 |
| PHP 5.4 | php54 |
| PHP 5.5 | php55 |
| PHP 5.6 | php56 |
PHP 7.x
| PHP Version | Command |
|---|---|
| PHP 7.0 | php70 |
| PHP 7.1 | php71 |
| PHP 7.2 | php72 |
| PHP 7.3 | php73 |
| PHP 7.4 | php74 |
PHP 8.x
| PHP Version | Command |
|---|---|
| PHP 8.0 | php8 |
| PHP 8.1 | php81 |
| PHP 8.2 | php82 |
| PHP 8.3 | php83 |
| PHP 8.4 | php84 |
| PHP 8.5 | php85 |
Checking the Active PHP Version
To check the version associated with the default PHP command, run:
php -v
Example output:
PHP 5.3.x
Zend Engine v2.3.0
By default, the SSH environment uses:
PHP 5.3
Using a Different PHP Version
To run a specific PHP version, use the corresponding command.
For example, to check PHP 7.3:
php73 -v
Example output:
PHP 7.3.x
Zend Engine v3.3.x
To run a PHP script using PHP 8.3:
php83 script.php
To run a PHP script using PHP 8.5:
php85 script.php
Examples
Execute a PHP Script
Using PHP 8.3:
php83 myscript.php
Run Composer with PHP 8.2
php82 composer.phar install
Check Loaded Modules
php83 -m
Display PHP Configuration
php83 -i
Important Notes
SSH PHP vs Website PHP
The PHP version used in SSH is completely separate from the PHP version configured for your website.
For example:
| Environment | PHP Version |
|---|---|
| Website | PHP 8.3 |
| SSH Console | PHP 5.3 (default) |
This is normal and expected.
Always Specify the Required Version
When running scripts, cron jobs, or Composer commands, it is recommended to explicitly specify the PHP version you want to use.
Example:
php83 artisan migrate
instead of:
php artisan migrate
This ensures your command runs with the correct PHP version.
Summary
The SSH environment supports multiple PHP versions, ranging from PHP 5.3 to PHP 8.5.
Common examples include:
php73 -v
php83 -v
php85 -v
Remember that the PHP version available through SSH is independent of the version configured for your website, and the default php command uses PHP 5.3 unless a specific version command is provided.