21. Mar 2023 |

Use specific php version in cli

In Zone webhosting I have several apps under one account. WordPress websites use PHP 7.4 (as WP does not support php 8). But my Laravel apps use PHP 8.

I can choose php version for server. For example:

laravel-app.mydomain.com – this uses php 8.0
wordpress.mydomain.com – this uses php 7.4

If I need to use command line interface (cli) then php version is always the same that I have set for my main domain settings. If I need to use specific PHP version in cli then I need PHPRC prefix before command of export PHPRC in the beginning of the bash script.

#!/bin/bash
export PHPRC=/etc/opt/zone/php80-cgi
php80-cli -v

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.