Can sites use PHP7?

Hi all,

I just need a quick sanity check. Does sympl support PHP7? And if so how do I set sites to use it rather than PHP5?

Cheers,
Chris

Yes, Sympl uses PHP 7.0 on Sympl 9 (Stretch) and PHP 7.3 on Sympl 10 (Buster).

If for some reason you’re still seeing sites served by PHP 5, you probably have a fair bit of stuff left over from a Debian Jessie install.

You’ll probably want to take a look at the PHP modules which are enabled, and swap them out for the modern versions, but it’s not a supported configuration in Sympl, and why we suggest a clean install rather than an upgrade.

That’s really weird - the server was spun up a few weeks ago and only ever had Stretch installed… Actually, I think that’s the case for all four of the servers I’m seeing the PHP5/PHP7 issue on.

Any advice on where to start switching over to PHP7, or should I just uninstall (via apt-get) PHP5?

Uninstalling php5 and libapache2-mod-php5 (check exact package names with apt-cache search) should do it.
Make sure you don’t have any old PHP code that breaks in PHP7 : unsafe features get deprecated on PHP upgrades, but there’s always an alternative and better method when that happens. I had that problem going from 7.0 to 7.3, in particular with PCRE matching becoming less error tolerant.

1 Like

You can get various PHP versions from https://deb.sury.org/ (PHP 5.6, 7, … 7.4) for all current versions of Debian - which might be useful if you find the applications don’t work on PHP7.0 but your Debian version doesn’t have PHP5.

To switch PHP version, once you’ve installed the various packages, you can use, for example :

a2dismod php5
a2enmod php7.0

(this just manages the symlinks in /etc/apache2/conf-enabled … )

You can have multiple PHP installations at once (e.g. php5 and php7.2, with binaries like /usr/bin/php5 and /usr/bin/php7.2), but only one version can be loaded into Apache at once if you’re using mod_php,