PHP/Upgrading to PHP 5.6

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

Installation
Install PHP 5.6:

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.

If necessary, unmask it:

Install APCu:

For PHP 7 compatibility:

Switch to PHP 5.6
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.

Uninstall incompatible extensions
Remove all old extensions that do not build for PHP 5.6. can be used for this task. Note that when piping to emerge, interactive mode cannot be used so  on the  command is not applicable here.

Be sure to migrate USE flags if versions have been specified in the file(s).

Now that extensions have been removed, it may be useful to run a dependency clean up at this point for older ones that are no longer compatible.

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.5:

Restart PHP-FPM
Restart PHP-FPM if applicable: