Last active
April 7, 2022 17:55
-
-
Save UbuntuEvangelist/cbfe9d6d8a8c67109d175ec0a74047f8 to your computer and use it in GitHub Desktop.
Switch php versions on commandline ubuntu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install PHP & check version | |
apt install software-properties-common | |
add-apt-repository ppa:ondrej/apache2 | |
apt update -y | |
apt upgrade -y | |
# For php7.3 (use any) | |
apt install -y php7.3 | |
apt install libapache2-mod-php7.3 php7.3 unzip php7.3-xml php7.3-mysql php7.3-imap php7.3-zip php7.3-intl php7.3-curl ntp -y | |
# For php7.4 (use any) | |
apt install -y php7.4 | |
apt install php7.4-{cli,fpm,json,common,mysql,zip,gd,mbstring,curl,xml,bcmath,imap,intl} | |
systemctl status php7.4-fpm | |
php --version | |
which php | |
whereis php | |
nano /etc/php/7.4/apache2/php.ini | |
# Find this lines by ctrl+w and change same as below: | |
file_uploads = On | |
allow_url_fopen = On | |
short_open_tag = On | |
memory_limit = 1024M | |
upload_max_filesize = 1024M | |
max_execution_time = 3600 | |
date.timezone = UTC+6 | |
ctrl+s and ctrl+x | |
apt update -y | |
apt upgrade -y | |
# SWITCH PHP VERSION | |
update-alternatives --config php | |
# Choose the appropriate version | |
Selection Path Priority Status | |
------------------------------------------------------------ | |
* 0 /usr/bin/php7.4 74 auto mode | |
1 /usr/bin/php7.3 73 manual mode | |
2 /usr/bin/php7.4 74 manual mode | |
Author
UbuntuEvangelist
commented
May 10, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment