Changing default version of PHP CLI for virtual host

It’s possible to change the default php CLI only for one virtual host ?


Yes, this is possible by using the following command:

update-alternatives --config php

Note that this command will set default PHP version for the system and not for a specific user or a virtual server.

I typed the command but nothing happened.

For RHEL systems the command is:

alternatives --config php

Although, you may need to manually create a new alternatives first.

Also, for a specific virtual server you should just use the full path to the PHP version executable explicitly or create a symlink (as a user) to the PHP version executable you want to be default in user ~/.local/bin directory (which should be always on the path).

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.