How to switch to another version of php in the terminal (terminal) and opr site beget
Come back
4

How to switch to another version of php in the terminal (terminal) and opr site beget

Change php version in user beget
We go to the page "site controls" there, select the site of your choice and go to:

version settings and php

And select the version you need:

php beget version selection


We execute commands in the terminal:

In the terminal, you may display a different php version with the command php -v . In some projects (for example, symfony as a composer), you have to execute commands but you need to change the version, in order to change the version we will do several commands in the terminal:

whereis php - see the list of available symbolic links (links to php versions)

which php - see the currently executing symbolic link (php version link)

alias php="/usr/local/bin/php7.2" - using the "alias" command we change / or add (if not) the current symlink (php version) selected from the list

php -v - see the version you switched to


After we understood how to change the php version in beget, now we create a file in the root of your site .bashrc

This is done so that when connecting to the server, you do not have to constantly change the version.

Next, write the command in the file: alias php="/usr/local/bin/php7.2"

beget alias command on file


If you had problems cleaning up a symfony project and needed to change the version, you can now clean up the cache:

- php bin/console cache:clear

created:
11.07.2020
updated:
15.11.2022
author:
admin
Tags
yandex metrika