Search This Blog

Labels

adobe (1) android (3) apache (3) aviation (1) bash (2) chrome (2) composer (1) cookery (3) dev (2) dodanperks (1) extensions (1) facebook (2) firefox (1) git (2) grafana (1) guzzle (1) headaches (11) htaccess (1) html5 (2) jquery (2) lamp (1) life hacks (10) linux (28) mysqli (2) native (1) opera (2) php (10) railfanning (1) reactjs (3) reactnative (1) servers (11) sinhala (1) smartphones (2) snap (1) sound (1) tech (22) troubleshoots (4) ubuntu (29) unicode (4) virtualbox (1) wamp (2) web (11) windows (4) wordpress (3) youtube (2) කෑම (3)

Wednesday, 18 December 2019

Update PHP to 7.4

NOTE: Replace version number to update into any PHP version.

1. Add repository if not already added

sudo add-apt-repository ppa:ondrej/php # Press enter to confirm.
sudo apt-get update

2. Install PHP 7.4

sudo apt install php7.4 php7.4-common php7.4-cli # Replace 7.4 with the version you are installing.

2.1. Install extensions

if you want to see what extensions that has already been installed.
dpkg -l | grep php | tee packages.txt
Install extensions from the new version.
sudo apt install php7.4-curl php7.4-json php7.4-gd php7.4-mbstring php7.4-mysql php7.4-intl php7.4-bcmath php7.4-bz2 php7.4-readline php7.4-zip # Change 7.4 with the version you are installing.

3. Bind with Apache

Check how it's bound to Apache2
apachectl -V
If it's mod_event,
sudo apt install php7.4-fpm
If it's prefork, which is commonly the case.
sudo apt install libapache2-mod-php7.4
sudo a2enmod php7.4

4. Uninstall old versions

sudo apt purge php7.3 libapache2-mod-php7.3 # Replace 7.3 with the version you had.

5. Check installation

php -v

No comments:

Post a Comment