Overview
The following explains how to use the command line to find related information about the PHP version your server is using.
Prerequisites
To run the commands in this article, you must configure a Shell user and log into your server via SSH.
Finding the PHP locations
The paths for the default DreamHost PHP-CLI installed binaries are as follows:
- PHP 8.1 — /usr/local/php81/bin/php
- PHP 8.2 — /usr/local/php82/bin/php
- PHP 8.3 — /usr/local/php83/bin/php
- PHP 8.4 — /usr/local/php84/bin/php
DreamHost maintains convenient shortcuts for all PHP versions in the /usr/local/bin/ directory:
lrwxrwxrwx 1 root root 16 Apr 12 13:11 php-8.1 -> ../php81/bin/php lrwxrwxrwx 1 root root 16 Apr 13 11:11 php-8.2 -> ../php82/bin/php lrwxrwxrwx 1 root root 16 Apr 12 11:33 php-8.3 -> ../php83/bin/php lrwxrwxrwx 1 root root 16 Apr 13 11:33 php-8.4 -> ../php84/bin/php
The /usr/local/bin directory is included in the shell path for users by default, so you can use the shortcuts instead of the full path to the binaries.
How to obtain PHP version information
This section explains how to view the specific versions of PHP and the modules installed with it.
Checking the PHP version
Run this command to view the default PHP-CLI version running on your server:
[server]$ php -v
You can view the exact version number by executing a specific binary. For example:
[server]$ php-8.3 -v
Checking installed modules
You can determine which PHP modules are installed for a specific version of PHP by running the following command:
[server]$ /usr/local/php83/bin/php -m