Jump to content

Enabling opcache with PHP 7


Recommended Posts

Posted

Hi guys,

I have finally upgraded our PHP from 5.6 to 7.1, but I am having trouble putting Zend opcache to work. When I enable it, the other websites I have on the same server throw random 500 errors (functions like require() and require_once() are the cause), and I start to see some crazy error messages in server's the error logs such as:

Quote

2017/08/06 10:49:59 [error] 4225#0: *16143 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 236223201352 bytes) in [redacted]/system/Patterns/ActiveRecord.php on line 82" while reading response header from upstream, client: 200.100.45.2, server: www.clubedohardware.com.br, request: "GET /forums/forum/53-seguran%C3%A7a-da-informa%C3%A7%C3%A3o/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.clubedohardware.com.br", referrer: "http://www.clubedohardware.com.br/forums/topic/1241859-com-problemas-no-chrome/"

Quote

2017/08/06 10:52:07 [error] 4220#0: *27200 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 9223378990237417624 bytes) in [redacted]/system/Notification/Table.php on line 86" while reading response header from upstream, client: 172.68.26.57, server: www.clubedohardware.com.br, request: "GET /notifications/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.clubedohardware.com.br"

Disabling opcache solves this issue, but of course I want opcache to improve performance.

Here are the installation details.

Compiled PHP with --enable-opcache

Relevant php.ini configuration:

Zend_extension = /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/opcache.so
opcache.enable=1
opcache.enable_cli=1
opcache.memory_consumption=128
opcache.max_accelerated_files=4000
opcache.max_wasted_percentage=5
opcache.use_cwd=1
opcache.save_comments=0
opcache.file_cache=/tmp

All other parameters were left commented out.

Error log is enabled, but log file isn't being created.

I tried adding this opcache.use_cwd=1 to try to solve the problem of other websites on the same server not working, at no avail.

Please also see a screenshot of the relevant part of our phpinfo:

opcache.thumb.png.638fad2884c2248e6ac434caf8426273.png

Full description of our setup can be found here: 

 

Thank you in advance.

Gabriel.
 

opcache.png

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...