Installing PHP 7.4 Beta4 on Ubuntu 18.04

Installing the new PHP 7.4 Beta 4 on an Ubuntu 18.04 server, 7.4 Beta4 was released on the 22nd of August 2019.

Start by updating package lists and information

sudo apt-get update

Next install apache and basic PHP module, which should be PHP version 7.3

sudo apt-get install apache2 php libapache2-mod-php

For 7.4 we will need to add a third party repository to download and install from, this is done like so:

apt-get install software-properties-common

add-apt-repository ppa:ondrej/php

apt-get update

Now PHP version 7.4 can be installed, this will do the latest release (Beta4):

sudo apt install php7.4-fpm

Time to switch the versions, from 7.3 to 7.4 and then restarting apache:

sudo a2dismod php7.3

sudo a2enmod php7.4

sudo service apache2 restart

Create a simple phpinfo() page to view the details…

<?php
phpinfo();

Which will among other things show you have PHP 7.4

installing php 7.4 beta ubuntu