Categories: Development

Upgrading to PHP 7.4 on Ubuntu

The anticipated PHP 7.4 version was released 28th November 2019 with a handful of new features and a slight speed improvement. Upgrading your now older PHP version can quickly and easily be done by following along this post.

This tutorial is based on an Ubuntu 18.04 server.

First step is to update repositories and add the ondrej PHP Personal Package Archive:

sudo apt-get update
sudo add-apt-repository ppa:ondrej/php

Install PHP 7.4 barebones with

sudo apt install php7.4 php7.4-common php7.4-cli

Install your PHP extensions that will be needed or used, common ones can be installed with:

sudo apt install php7.4-mysql php7.4-curl php7.4-json php7.4-gd php7.4-mbstring php7.4-intl php7.4-bcmath php7.4-bz2 php7.3-readline php7.3-zip

Apply the new PHP module to your web server, if using an Apache or Nginx webserver:

sudo apt install php7.4-fpm

Find your current installed and active version of PHP with

php -v

Or create a PHP file with

<?php
phpinfo();

Here mine was 7.3

PHP version 7.3

Disable the current active PHP version with

sudo a2dismod php7.3

And enable the newly installed 7.4

sudo a2enmod php7.4

Restart apache and check the phpinfo file

sudo systemctl restart apache2
PHP version 7.4

You now have PHP 7.4 installed and active.

Share

Recent Posts

Kennington reservoir drained drone images

A drained and empty Kennington reservoir images from a drone in early July 2024. The…

2 years ago

Merrimu Reservoir drone images

Merrimu Reservoir from drone. Click images to view larger.

2 years ago

Early September spring shots

Some early September spring shots from a bushwalk, It is still too early for wildflowers.

3 years ago

Cloning an NVMe to SK Hynix Platinum P41 NVMe

I recently needed to clone over a smaller NVMe to a 2TB SK Hynix Platinum…

3 years ago

Using Laravel’s deleteDirectory to delete folders and their contents

If you ever needed a simple solution in Laravel to delete an entire directory and…

3 years ago

How to allow only 1 user to register in a Laravel application

How to enforce only one user to register or be registered in a Laravel web…

3 years ago