Skip to content

Change PHP cli version used with SSH as configured in your .php-version

Notifications You must be signed in to change notification settings

mathieu-coingt/infomaniak-ssh-php-version

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Infomaniak webhosting bashrc

Infomaniak webhosting offers SSH access to your account.

This .bashrc switches the PHP cli version as configured in your .php-version.

How to use it

1/ To install this .bashrc, open an SSH connexion to your webhosting account.

2/ Then get the latest version from github and profit :

wget https://raw.githubusercontent.com/mathieu-coingt/infomaniak-ssh-php-version/main/.bashrc -O $HOME/.bashrc
source $HOME/.bashrc

3/ Finally, you have to create a .php-version file in your folders where you want to change you PHP cli version : see exemple in this repository.

Just write in this file the PHP version you want to use. Possible values are the one you can choose in your Infomaniak manager :

  • 8.0
  • 7.4
  • 7.3
  • 7.2
  • 5.6

Enhanced the prompt

Also, you can use the .bash_profile file given here, wich will show you in the prompt the PHP cli version used, and also gave you some colors ;-)

wget https://raw.githubusercontent.com/mathieu-coingt/infomaniak-ssh-php-version/main/.bash_profile -O $HOME/.bash_profile

How to test it

You may have to close your SSH connection and connect again. You can check the changes by navigating in your folder where you have write .php-version file : your prompt has to indicate you the PHP cli version used, and you can verify it by tiping php -v

Result expected

Before

image

After

image

About

Change PHP cli version used with SSH as configured in your .php-version

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages