To execute a php file with different php version than the version installed on the main php of your Server follow this:
You should know that where is that php version located so that you can add the path.
In my case I want to use PHP 7 that is installed in the plesk hosting panel folder so I’ll run following command:
In above code server.php is the file which we want to execute. Just enter above command in the ssh terminal and it will execute successfully.
If your php is located in some other location then get that path and run in the same manner as I did above.
OS: CentOS 6.7 x 64