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…

1 year ago

Merrimu Reservoir drone images

Merrimu Reservoir from drone. Click images to view larger.

1 year ago

FTP getting array of file details such as size using PHP

Using FTP and PHP to get an array of file details such as size and…

2 years ago

Creating Laravel form requests

Creating and using Laravel form requests to create cleaner code, separation and reusability for your…

2 years ago

Improving the default Laravel login and register views

Improving the default Laravel login and register views in such a simple manner but making…

2 years ago

Laravel validation for checking if value exists in the database

Laravel validation for checking if a field value exists in the database. The validation rule…

2 years ago