typo3hostingtypo3-7.6.xhttp-status-code-500opcache

TYPO3: OPcache activation causes server error in TYPO3 backend


I have some trouble with TYPO3 and opcache activation and hope someone can help me :).

Environment details:

Situation:

If I enable PHP7 without opcache option then everything is working fine, but if I enable PHP7 with opcache option then I got irregular 500 errors in the backend of TYPO3 and the site is down for a few seconds or minutes. After this few seconds I could reload the page and everything is working until the next server error appears. So it seems that a server process is restarting after this crash.

Actions like opening the extension configuration of the TYPO3 backend extension and press save will lead to the server error. The server logs and the error logs are empty and for this reason the Alfahosting support can't help me.

Furthermore I have mirrored the TYPO3 on two other webservers (not Alfahosting), also PHP7 and opcache option enabled and got no problems on this two webservers. After that I have installed a fresh TYPO3 7.6.23 on a Alfahosting webserver (see environment details above) and I got the annoying 500 server error again. So I think a specific Alfahosting server configuration leads to the 500 server errors if opcache is enabled, but I am not a server admin and I don't know how I could solve this problem without changing the hosting :(.

So I hope someone could help me? Maybe it's possible to track the error to find out where the problem is?


Solution

  • Update:

    This sounds like the files have not been refreshed in opcache. This can be the case if opcache.revalidate_freq is set to > 0 or opcache.validate_timestamps=0.

    In this case you should make sure you flush opcache when you make changes to PHP files, including updating TYPO3 or your extensions. For example, set this up in your deployment / update pipeline, for example by doing apache2 reload, php-fpm reload, use gordaline/cachetool or flush Opcache in the TYPO3 Backend (Maintenance).

    Please read the PHP documentation for the opcache settings and check your current settings (can be found in the TYPO3 backend: Environment | PHP Info). Particularly the following come with a risk:

    ; make sure you flush opcache if PHP scripts change.
    opcache.validate_timestamps=0
    
    ; make sure you flush opcache if PHP scripts change.
    opcache.revalidate_path= .... higher value > 0
    
    ; should be set to 1 for TYPO3
    opcache.save_comments = 0
    

    Resources:


    Check the TYPO3 system reports for any obvious errors:

    Now check the logs