I have been working on PHP 7 packages for a while. They are available in my repository:
[php] Server = https://repo.pierre-schmitz.com/$repo/os/$arch
Insert these lines on top of the other repository definitions in your /etc/pacman.conf
A copy of the PKGBUILDs I used to create the packages are available in my git repository.
Upstream changes
PHP 7 is possibly one of the most interesting releases since version 5 which was published over a decade ago. Besides up to twice the performance PHP now offers scalar type declarations and return types. The official migration guide lists all new features and incompatible changes.
Packaging changes
With PHP 7 I am trying to move closer to upstream defaults and be less opinionated. While this requires a more responsible configuration by the user it also eliminates some surprises. And after all this is the Arch way. As a bonus, scripts like Composer work fine with the default configuration now.
Core package changes
- php-pear is no longer available
- php-mssql was removed by upstream
- php-ldap is now included in the core php package as its dependencies were already met
- The mysql extension was dropped upstream and is no longer available
Configuration changes
- openssl, phar and posix modules are now built in. Remove the corresponding directives from you
php.ini
, e.g.extension=openssl.so
- The
include_path
is no longer set to/usr/share/pear
by default open_basedir
is no longer defined. This also means that packaged scripts do not need to be put into an awkward/usr/share/webapps
directory.- PHP-FPM does no longer provide a logrotate configuration. By default errors are logged to syslog (these will be picked up by journald).
- FPM pool configuration is now stored in
/etc/php/php-fpm.d
by default. - The upstream FPM service file is now installed which does not include
PrivateTmp=true
.
Third party extensions
We offer a few PHP modules that are maintained by third parties and are not part of the PHP source distribution. So far only modules that are in active development were able to provide updated versions. This means we have to drop most of these PHP extensions, especially those that might be considered dead.
The following list provides an overview of modules I gathered so far. It is possible we could re-upload updated packages once upstream provides us with compatible versions.
Package | Status | Solution |
---|---|---|
graphviz | incompatible | remove PHP bindings |
php-apcu | compatible | update to version 5 |
php-geoip | incompatible | remove package |
php-memcache | incompatible | remove package, project seems dead |
php-memcached | incompatible | remove package, move back when upstream version is available |
php-mongo | incompatible | remove package, superseded by the mongodb driver |
php-xcache | incompatible | remove package, project seems dead |
uwsgi-plugin-php | incompatible | remove PHP support, upstream update seems possible |
xdebug | compatible | update to latest release candidate of version 2.4 |
In addition to this I will introduce a new module called php-apc-bc which will provide the legacy apc_
function for use with the APCu extension. Before version 5 this feature was provided by APCu itself.
Testing in Production
While I have been working on PHP 7 for months now one really only sees how it performs when put into production. So a few days ago I started running all services at archlinux.de (this also includes this very blog) with that latest version of PHP.
So far its running fine. The update went smoother than expected and the needed configuration changes were close to nonexistent.
There are some regular but very few core dumps produced by php-fpm. These did not result in 5xx server responses though and I assume that they are related to shutting down fpm workers. It should be investigated but it does not seem critical.
Before updating I had to make two small source code changes:
- Engine errors are now of the type
\Error
.\Error
and\Exception
implement the\Throwable
interface. So I had to adjust a type hint, or in this case remove it so it would also work in PHP 5.6. - The return type of the
\SessionHandlerInterface
are now enforced. If you return anything other than a string in your custom session handler the operation will fail.
Your Feedback
Now it is your turn. The packages provided in my repository are ready and I will ensure an upgrade path once the updated packages are available in the [extra] repository. I do not plan to hold them back for very long but I’d like to get some feedback first. After all it is a major update, we drop a lot of extensions and compatibility with many scripts out there is unknown.
Try these packages, test your own code and send me your feedback and suggestions.
Nice thank you for the update. I had no big trouble adjusting php-fpm and php configs so everything is working fine now. Unfortunately I had to get php7-pear from the AUR, so maybe you could package this as well?
Best regards,
Jonas
Thanks for testing. It seems everybody in the PHP community moved over to Composer. How exactly do you use PEAR? I guess if there is enough demand and valid use cases it can be added. At least it should be possible to maintain a standalone AUR package.
Hi Pierre,
I second the issue of Onny, please provide php-pear
for example:
https://github.com/drupal-composer/drupal-project
relies on on pear.
This seems to work fine without pear. It even has composer written all over it. Note that composer is able to install PEAR libraries into its vendor folder.
What about pecl? Base package? I can’t remember if php-pear provided pecl or not.
I don’t see how it requires PEAR. The line suggested under “Usage” works fine without it:
composer create-project drupal-composer/drupal-project:8.x-dev some-dir –stability dev –no-interaction
There also is no mention of PEAR anywhere on that page.
I had a dependency on pear with roundcubemail (I created the beta package roundcubemail-beta in the AUR which is php7 ready)
Roundcube does not really depend on PEAR (the package manager). In fact they also moved to composer. They provide a complete tar which includes all its dependencies.
The package in [community] actually depends on PEAR. I have contacted the maintainer about this and hope these unnecessary dependencies can be removed.
UPDATE: roundcubemail in [extra] no longer depends on PEAR and all pear-* packages have been removed from the repository.
This means there are currently no packages that require php-pear.
Thank you for your efforts! Everything seems to be working great after a painless upgrade.
The only thing I would suggest is an post-update message for the ‘php-apache’ package, something like this:
“If you are using Apache with libphp, update your httpd.conf to use libphp7”
Thanks, that’s a good hint for the announcement message. Install scripts shouldn’t be really used for documentation though.
Thanks for your effort. I’m trying to setup my development enviroment using multithreaded apache. But it complains that libphp7.so is not compiled with multithreading support. Is there a possibility to add it to the repository? Apart from my issues it’s pain free to install :)
Sorry for spamming, its false alarm, just just needed to RTFM :D
I initially just wanted to drop mod_php all together as I just don’t see the point of it :-)
Thanks, Pierre. Your continued great work is much appreciated. I was able to upgrade to PHP7 using your instructions, with no major issues.
Hey, do you have any information on when the php7 will be available in official repos?
Pretty soon. If no more issues come up PHP 7 should hit [extra] within the next two week. Likely still this year.
there is some problems with xdebug…
It has already been fixed in the upstream, you can build it from source or wait for updated version of package.
Thanks for the hint. Indeed 2.4.0RC3 is broken with PHP 7. I uploaded a git snapshot which seems to work for me.
Runs fine as far as i can tell, tested some cli scripts, composer and websites with it, no issues so far. XDebug works fine for me too.
Thanks for your work!