bash script to switch PHP versions in Plesk command line

I found myself needing to switch between PHP versions on the command line running under the Plesk environment on a CentOS server. Some apps ran under PHP 5.6, some under 7.0 and others being pushed towards 7.1. This script allows me to be quickly switch between them. It looks for the current PHP version in the PATH and changes just that.

My shell scripting is a little rusty, so you may have some improvements. It shows the PATH before and after, so you should be able to spot if it breaks things, and quickly fix it.

No comments yet.

Leave a Reply