How to compile PHP 7.4 on Ubuntu 18.04


On November 28, 2019 the PHP development community released version 7.4, which incorporated new features, of which we mention some:

  • Typed properties
  • Arrow functions
  • Number separators
  • Weak references
  • Support for argon2i and argon2id

For a list of all changes see: Update to PHP 7.4

Goals

  • Update to the latest version of PHP
  • Get benefits from the latest language features
  • Correct errors from previous versions
  • Customize the installation process

Prerequisites

This tutorial assumes that:

  • You have some knowledge about GNU/Linux
  • You have Ubuntu 18.04 installed
  • You are familiar with the command interpreter
  • You are familiar with the compilation process

Update your OS

$ sudo bash -c 'apt update && apt upgrade'

Compile/Install

To compile/install PHP we will use the tool Butterfly Builder

Download Butterfly Builder

You can download Butterfly Builder from NotAbug o typing:

$ curl -# -LO https://notabug.org/sedlav/butterfly-builder/archive/ubuntu18.04-php7.4.tar.gz

If you get an error about missing curl you can install it by

$ sudo apt -y curl

Unpack

$ tar xzvf ubuntu18.04-php7.4.tar.gz

Change to butterfly-builder DIR

$ cd butterfly-builder

The available PHP version while writing this tutorial is 7.4.4. Set the configuration values int the build.ini file according to your needs.

php_version=7.4.4
compression=tar.xz
php_mode=fpm
fpm_user=phpfpm
fpm_group=phpfpm
fpm_listen=9000
web_server=builtin
install_prefix=/usr/
sysinit=systemd
sysinit_versioned=true
databases="mysql sqlite postgre"
php_env=dev

Download the digital signature for version 7.4.4 using the sigd tool, sigd uses the jq tool, install it by executing

$ sudo apt -y install jq

Exec sigd

$ ./sigd

Compile/Install

./build

Once the installation process is finished, put in your browser the IP of the server where the installation was executed http://IP:8080/info.php. See the post-install/ubuntu-builtin file for more details.

Ubuntu 18.04/PHP 7.4

How to compile PHP from the source code, 3 (11)

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.