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 5.6 – /usr/local/php56/bin/php
- PHP 7.0 – /usr/local/php70/bin/php
- PHP 7.1 – /usr/local/php71/bin/php
- PHP 7.2 – /usr/local/php72/bin/php
For convenience, DreamHost maintains shortcuts for all PHP versions in the ‘/usr/local/bin/’ directory:
lrwxrwxrwx 1 root root 16 Mar 16 07:22 php-5.6 -> ../php56/bin/php lrwxrwxrwx 1 root root 16 May 11 11:57 php-7.0 -> ../php70/bin/php
lrwxrwxrwx 1 root root 16 Jul 26 19:28 php-7.1 -> ../php71/bin/php
lrwxrwxrwx 1 root root 16 Jan 30 19:28 php-7.2 -> ../php71/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.
You can confirm the exact version numbers in use by executing the binary from within the shell using the "-v" option. For example, you can check the version of the PHP7.1 CLI binary as follows:
[server]$ php-7.1 -v PHP 7.1.7 (cli) (built: Jul 27 2017 02:26:49) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
The default PHP CLI interface on DreamHost can be seen by running php -v
[server]$ php -v