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.
How to compile PHP from the source code, 3 (11)
- How to compile PHP 7.1 in Ubuntu 16.04
- Butterfly Builder, a tool to compile PHP
- How to compile PHP 7.4 on Ubuntu 18.04
- How to compile PHP-7.3 en Debian
- How to compile PHP-7.2 on CentOS
- How to Compile PHP 8.0 in Debian 10?
- Compile php 5.5 with apache prefork support
- Compile PHP-5.6 with Apache Worker support
- Compile php-5.6 with fpm support
- How to compile PHP-5.6 on CentOS 7
- Compile PHP 7 on Debian 8