PHP/Upgrading to PHP 7.1
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.
To upgrade a system to PHP 7.1, first set the PHP_TARGETS variable in make.conf:
Install PHP 7.1:
emerge --ask dev-lang/php:7.1
To build with the
opcache USE flag (the default) while allowing the use of APC userland functions such as
apc_fetch(), install APCu, which emulates APC but only has user caching functions. This may be necessary for older projects that rely on APC for caching.
emerge --ask dev-php/pecl-apcu
The PHP 7 versions of pecl-apcu have a new syntax which need changes to support. Fortunately, there is a compatibility package, dev-php/pecl-apcu_bc:
emerge --ask dev-php/pecl-apcu_bc
Switch to PHP 7.1
Switch to it using eselect for all SAPIs:
eselect php set cli php7.1
eselect php set fpm php7.1
When other SAPIs are in use, be sure to run eselect for those as well.
Re-install compatible extensions
Since changing PHP_TARGETS is technically a USE flag change, it suffices to simply emerge @world with flags checking for new USE flags and all extensions should re-build.
emerge --ask --changed-use --deep @world
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:
emerge --ask -vc dev-lang/php:5.6
Restart PHP-FPM if applicable: