CMS fails to run after Apache/PHP upgrade

SilverStripe version: v3.1
Can someone help this SS novice get our CMS going again please after an Apache/PHP upgrade?

Our SS is a simple website & runs out of a VPS, & we recently upgraded its apache to v2.4 & php to v5.6 (& migrated from EasyApache3 to EA4). The process worked ok (with a few tweaks to get the main website running), but now that we come to use the CMS, we find it wont get past the /admin login page.

After enabling full php logging (error_reporting = E_ALL & display_errors = On), in the framework/error_log there’s only the following when trying to log in:

PHP Warning: Cookie 'alc_enc' can't be set. The site started outputting content at line 2 in /home/USERNAME/public_html/framework/parsers/Zend/Locale.php in /home/USERNAME/public_html/framework/control/Cookie.php on line 117

(Locale.php line #2 is “<?php”, while Cookie.php 117 appears to check for a valid cookie set)

The more reading I do, the more I learn but more confused too:

  • is this a php 5.6 issue? have tried switching back to 5.4, no change
  • a timezone/locale issue? php.ini has: date.timezone=“UTC”
  • an apache / php modules issue - I have a list of all modules available & loaded/not, but not clear sure what to look for other than ensuring the SS system requirements are satisfied
  • a zend framework issue? Has the AE3->EA4 updated it? (only “Zend” modules mentioned in EA4 are “The Zend OPcache” & “Loader for Zend Guard-encoded PHP files” but they are both disabled)
  • Zend Guard module - unsure of role but tried uninstalling/disabling
  • checked basic options: safe_mode = Off, magic_quotes_gpc = Off, memory_limit already = 1024M
  • caches: had to clear the staticmanifest directory to allow php version changes, so repeated this with all the cache directories, but no improvement

There are other entries in the in the framework/error_log but not directly associated with trying to access the CMS. There’s nothing of interest in Apache access_log, error_logs, or suphp_log files.

FYI, upon entering a valid username/PW, the browser redirects as follows, and returns to the login page again, with no error message on screen:
Redirecting to /admin/pages… (output started on /home/USERNAME/public_html/framework/parsers/Zend/Locale.php, line 2)

Redirecting to /Security/login?BackURL=%2Fadmin%2Fpages… (output started on /home/USERNAME/public_html/framework/parsers/Zend/Locale.php, line 2)

Any pointers as to where to look next would be really appreciated at this stage.
Thank you.

Try clearing the cache url?flush=all, if there is any ‘silverstripe-cache’ folder in root , empty the folder and flush again. if may help

Thanks for the suggestion thomas28.

After emptying the ‘silverstripe-cache’ dir, a “url?flush=all” request gave this
PHP Warning: Cannot modify header information - headers already sent by (output started at /home/futrix/public_html/framework/parsers/Zend/Locale.php:2) in /home/futrix/public_html/framework/main.php on line 152
But going to url/admin gave the usual PHP Warning: Cookie 'alc_enc' can't be set.

We also see this error message too:
Couldn’t set response type to 404 because of output on line 2 of /home/futrix/public_html/framework/parsers/Zend/Locale.php in /home/futrix/public_html/framework/control/HTTPResponse.php on line 257

FYI, line 257 is associated with test “if($this->statusCode >= 300)” in function output()

Thank you

Your project files (all the php files in mysite folder)

Do they contain closing php tags at the end?
?>

If so remove them

Thanks CW_Chong - after checking various php files, which looked fine (have opening but no closing tags), but I noticed there appeared to be a whitespace character before the ‘<?php’ in /home/USERNAME/public_html/framework/parsers/Zend/Locale.php
and removing that allowed the CMS to run!

Thanks all for the help.

I don’t think line #2 of Locale.php should be <?php; the opening tag should be on the very first line of the file.

Thanks Firesphere, yes that was it! Thanks to the Forum for the help.