This post looks at the minimum PHP version requirements for SilverStripe. I will update this page as new versions are released and I upgrade the various SilverStripe websites I manage, noting any issues I experience. Please share also any experiences you have in the comments section at the end of the post.
SilverStripe Server Requirements Page
The Server Requirements page on the SilverStripe website currently notes PHP 5.2.0+ is recommended, but see my notes below for any issues I find with various versions.
PHP versions I use
Until the end of December 2010 I was running SilverStripe on both CentOS 5 / PHP 5.1.6 and Debian 5 / PHP 5.2.6 servers. From January 2011 the CentOS 5 box was retired so I will no longer test SS on PHP 5.1.6, but this fits in quite nicely with SS 2.4.4 no longer working on PHP 5.1.6 as noted below.
Requires PHP >= 5.2.0
It would appear the minimum requirement for SilverStripe 2.4.4 is PHP 5.2.0 as there is an issue with the call to session_set_cookie_params() which passes parameters only supported from PHP 5.2.0 and will issue a warning in earlier versions.
The issue is in sapphire/core/Session.php on lines 436 & 438 when session_set_cookie_params() is called, passing the $httponly parameter. I have tested this on CentOS 5 which has PHP 5.1.6 and it will issue a warning on every single page request, resulting in SilverStripe displaying an error page instead of the content.
This particular issue results in a “Warning: Wrong parameter count for session_set_cookie_params()” error.
SilverStripe 2.4.0 to 2.4.3
Minimum recommended version PHP >= 5.2.0
Minimum working working PHP 5.1.0?
The Server Requirements page on the SilverStripe website notes that 5.2.0+ is recommended but versions as low as 5.1.0 have been known to work.
If you are currently running CentOS 5 and do not wish to use anything other than the bundled version (and security updates) of PHP then you are stuck with 5.1.6.
I have been personally running an instance of SilverStripe on CentOS 5 / PHP 5.1.6 and the only issue I have had myself is with the lack of the json_encode() and json_decode() functions which are available from PHP 5.2.0.
This can be solved by installing a copy of the PEAR Services_JSON package or using the PECL version. I used the PEAR version myself and don’t have any experience using PECL.