Forked from UbuntuEvangelist/How to switch php version in ubuntu
Created
June 2, 2021 17:41
-
-
Save LinuxFintech/b95a2a08cdfee90d6a168a2716ed5ebd 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 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment