How to compile PHP-7.3 en Debian

Español English

On December 6, 2018 the PHP development community released version 7.3, which incorporated new features, here some of them:

  • More Flexible Heredoc and Nowdoc Syntax
  • Array Destructuring supports Reference Assignments
  • instanceof Operator accepts Literals
  • Trailing Commas are allowed in Calls
  • PCRE2 migration
  • Performance of the Multibyte String extension has been significantly improved

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

Debian GNU/Linux is an ideal distribution for server environment due to its robustness and stability but this means that it does not include in its official repositories the most recent versions of its applications, so if we want to have the latest version of PHP we must compile it from the source code.

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 Debian GNU/Linux 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://github.com/yoander/pbt/archive/debian9-php7.3.zip

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

$ sudo apt -y curl

Unpack

$ tar xzvf debian9-php7.3.zip

Change to butterfly-builder DIR

$ cd butterfly-builder

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

php_version=7.3.16
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.3.16 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/debian-builtin file for more details.

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.