DreamHost offers command line interface versions of PHP that are useful for developing shell applications. There are quite a few differences between the CLI (Command Line Interface), SAPI (Server Application Programming Interface), and other SAPIs (such as PHP-CGI). It's worth mentioning that CLI and CGI are different SAPIs even though they share many of the same behaviors. To learn more about these differences, you can begin by reviewing the PHP Manual's chapter, Using PHP from the command line.
View the following article for instructions on how to access your Shell.
The paths for the default DreamHost PHP-CLI installed binaries are as follows:
- PHP 8.0 – /usr/local/php80/bin/php
- PHP 8.1 – /usr/local/php81/bin/php
- PHP 8.2 – /usr/local/php82/bin/php
For convenience, DreamHost maintains shortcuts for all PHP versions in the /usr/local/bin/ directory:
lrwxrwxrwx 1 root root 16 Apr 12 11:33 php-8.0 -> ../php80/bin/php 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
/usr/local/bin is included in the shell PATH for users by default, so you can use the shortcuts instead of the full path to the binaries.
Support for outdated PHP versions is being removed from DreamHost servers, and their binaries may no longer be available on your server via the command line.
Checking the version via SSH
You can confirm the exact version numbers in use by executing the binary from within the shell using the "-v" option. For example:
[server]$ php-8.2 -v
The default PHP CLI interface on DreamHost can be seen by running php -v
[server]$ php -v
Checking PHP modules installed
You can determine which PHP modules are installed for a specific version of PHP by running the following command.
[server]$ /usr/local/php82/bin/php -m
Just change the PHP number to the version you wish to check. Your terminal will then output all installed modules.