PHP/Upgrading to PHP 7.1

Compatibility check
PHP 7 has some major changes from the previous 5.x versions. All scripts should be checked before upgrading.

PHP 7 Compatiblity Checker is a wonderful tool to do this automatically.

PHP Static Analysis Tool is an amazing tool to check your code as if it was running. This is beyond syntax checking.

PHP Targets
To upgrade a system to PHP 7.1, first set the PHP_TARGETS variable in :

Installation
Install PHP 7.1:

Replace APC
To build with the  USE flag (the default) while allowing the use of APC userland functions such as , install APCu, which emulates APC but only has user caching functions. This may be necessary for older projects that rely on APC for caching.

Install APCu:

The PHP 7 versions of pecl-apcu have a new syntax which need changes to support. Fortunately, there is a compatibility package, :

Switch to PHP 7.1
Switch to it using for all SAPIs:

When other SAPIs are in use, be sure to run  for those as well.

Re-install compatible extensions
Since changing PHP_TARGETS is technically a USE flag change, it suffices to simply with flags checking for new USE flags and all extensions should re-build.

Migrate the configuration files
The different slots have different configuration paths. Please take care to migrate the configuration files before making use of a new slot.

Uninstall old PHP versions
For example, to remove PHP 5.6:

Restart PHP-FPM
Restart PHP-FPM if applicable: