On November 30, 2017 the PHP development team released the PHP 7.2 version, this release added news features, here some of them:
- New object type: Previously the object statement was used to convert one data type to another one e.g. an array to an sdtClass object and/or vice versa, PHP 7.2 introduces the object data type which can be used to specify the type of parameter and/or for the type of a function return.
- Extension loading by name: Now it is not necessary to specify the file extension (.so for Unix, .dll for Windows) when loading an extension allowing greater portability in the php configuration file (php.ini).
- Abstract method overriding: Now an abstract class that inherits from another abstract class can change/overwrite an abstract method of its parent class.
- Sodium is now a core extension: Sodium is a modern and easy to use encyption library that allows encryption/decryption, signatures, password hashing and more… now the extension is part of the PHP core.
- Parameter type widening : Now a child class can omit the parameter type when overwrite or implement a method from the parent class or interface respectively.
- Update to the latest version of PHP
- Get benefits from the latest language features
- Correct errors from previous versions
- Customize the installation process
This tutorial assumes that:
- You have some knowledge about GNU/Linux
- You have CentOS GNU/Linux installed
- You are familiar with the command interpreter
- You are familiar with the compilation process
To compile/install PHP we’re going to use the butterfly builder
You can download butterfly builder from github or typing:
$ curl -# -L -O https://github.com/yoander/pbt/archive/master.zip
$ unzip master.zip
If the unzip command is not found you can install it, executing:
# yum -y install unzip
Cambiar al DIR pbt-master
$ cd pbt-master
The PHP available version at the time of writing this tutorial is 7.2.32. Set the settings through the pbt.init file according to your needs.
php_version=7.2.6 compression=tar.xz php_mode=fpm fpm_user=phpfpm fpm_group=phpfpm fpm_listen=9000 web_server=nginx install_prefix=/usr/ sysinit=systemd sysinit_versioned=true databases="mysql sqlite" php_env=dev
Give execution permissions.
$ chmod a+x pbt
After the build, compilation and install process finish, you can get PHP information typing in your browser http://IP/info.php
How to compile PHP from the source code, 5 (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