To set a specific version of PHP used on the command line you must set your $PATH
environment variable
appropriately. For example, to require version 8.4, you should set your $PATH
with something like:
PATH=/usr/local/php/8.4/:${PATH}
To use a specific version of PHP for a one-off usage or from a script where editing $PATH
isn't
convenient, you can specify the minor version you want as part of the command name. E.g., php8.3
will
invoke PHP 8.3 and php8.4
will invoke PHP 8.4.
If you do not specify the version of PHP you want (e.g., by just running php
with no $PATH
set) you will get whatever version was the default at the time the realm was created.
Each software realm provides a variety of PHP versions, all of which are located in the /usr/local/php directory. In addition to versions for each specific release, there are also symbolic links to our officially supported version of each minor version of PHP. E.g., for PHP 8.4, there is a symbolic link named "8.4." You should use the minor version links instead of specific patch directories (e.g., "8.4.8-nfsn1") whenever possible; specific patch releases may be removed at any time without notice.