Skip to content

Instantly share code, notes, and snippets.

@aamsur-mkt
Last active March 19, 2020 06:14
Show Gist options
  • Save aamsur-mkt/9a1d89639386e1fdb4b6d15ec381aa46 to your computer and use it in GitHub Desktop.
Save aamsur-mkt/9a1d89639386e1fdb4b6d15ec381aa46 to your computer and use it in GitHub Desktop.
Upgrade Php7.0 to php7.2 with phalcon3
# ref https://ayesh.me/Ubuntu-PHP-7.2
# remove existing phalcon repo
curl -s https://packagecloud.io/install/repositories/phalcon/stable/script.deb.sh | sudo bash
rm -rf /etc/apt/sources.list.d/phalcon*
sudo apt-get update
# add ondrejphp repo
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
# upgrade packages
# this action will have a downtime
sudo apt-get upgrade -y
# install php7.2 repo
sudo apt-get install php7.2 php7.2-bz2 php7.2-cgi php7.2-cli php7.2-common php7.2-curl php7.2-dev php7.2-fpm php7.2-gd php7.2-intl php7.2-json php7.2-mbstring php7.2-mysql php7.2-opcache php7.2-pgsql php7.2-phalcon php7.2-readline php7.2-xml php7.2-zip php7.2-redis libapache2-mod-php7.2 php7.2-phalcon3
sudo apt-get install -f
# php-phalcon4 sometimes will broke the installation
# error like this may appear
# trying to overwrite '/etc/php/7.3/mods-available/phalcon.ini', which is also in package php-phalcon4 4.0.4-1+ubuntu16.04.1+deb.sury.org+1
# fix it with
sudo dpkg -P php-phalcon4
# or (depends on your error)
sudo dpkg -P php7.0-phalcon
# then
sudo apt-get install php7.2-phalcon3
# check phalcon version with
php --ri Phalcon
php -r "echo Phalcon\Version::get();"
# make sure it showing with no errors
# switch current php to php7.2
# You can disable the current PHP integration with a2dismod php7.1 (or your current version) and enable new PHP 7.2 module with a2enmod php7.2.
sudo a2dismod php7.0 && sudo a2enmod php7.2
# remove old php
# depends on your old php version
sudo apt purge php7.0*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment