Creating or editing invoice/quote shows blank page/500 server error

When I attempt to create a new quote or invoice, or view an existing one, I am met with a blank page or sometimes a 500 internal server error.

Selfhosted, v4.5.5 (issue was also present on 4.5.4).

Apache log:

[Thu Oct 11 12:51:19.936736 2018] [cgi:error] [pid 4082] [client xxx.xxx.xxx.xxx:55721] AH01215: : /usr/local/cpanel/cgi-sys/ea-php71, referer: https://clients.exampledomain.com/invoices
[Thu Oct 11 12:51:19.936820 2018] [cgi:error] [pid 4082] [client xxx.xxx.xxx.xxx:55721] AH01215: mmap() failed: [12] Cannot allocate memory: /usr/local/cpanel/cgi-sys/ea-php71, referer: https://clients.exampledomain.com/invoices
[Thu Oct 11 12:51:19.937510 2018] [cgi:error] [pid 4082] [client xxx.xxx.xxx.xxx:55721] AH01215: : /usr/local/cpanel/cgi-sys/ea-php71, referer: https://clients.exampledomain.com/invoices
[Thu Oct 11 12:51:19.937560 2018] [cgi:error] [pid 4082] [client xxx.xxx.xxx.xxx:55721] AH01215: mmap() failed: [12] Cannot allocate memory: /usr/local/cpanel/cgi-sys/ea-php71, referer: https://clients.exampledomain.com/invoices
[Thu Oct 11 12:51:19.952415 2018] [cgi:error] [pid 4082] [client xxx.xxx.xxx.xxx:55721] AH01215: : /usr/local/cpanel/cgi-sys/ea-php71, referer: https://clients.exampledomain.com/invoices
[Thu Oct 11 12:51:19.952486 2018] [cgi:error] [pid 4082] [client xxx.xxx.xxx.xxx:55721] AH01215: mmap() failed: [12] Cannot allocate memory: /usr/local/cpanel/cgi-sys/ea-php71, referer: https://clients.exampledomain.com/invoices
[Thu Oct 11 12:51:19.952592 2018] [cgi:error] [pid 4082] [client xxx.xxx.xxx.xxx:55721] AH01215: : /usr/local/cpanel/cgi-sys/ea-php71, referer: https://clients.exampledomain.com/invoices
[Thu Oct 11 12:51:19.952616 2018] [cgi:error] [pid 4082] [client xxx.xxx.xxx.xxx:55721] AH01215: mmap() failed: [12] Cannot allocate memory: /usr/local/cpanel/cgi-sys/ea-php71, referer: https://clients.exampledomain.com/invoices
[Thu Oct 11 12:51:19.952674 2018] [cgi:error] [pid 4082] [client xxx.xxx.xxx.xxx:55721] AH01215: PHP Fatal error:  Out of memory (allocated 33554432) (tried to allocate 606208 bytes) in /home/travis/public_html/exampledomain.com/clients/vendor/symfony/http-foundation/Response.php on line 358: /usr/local/cpanel/cgi-sys/ea-php71, referer: https://clients.exampledomain.com/invoices
[Thu Oct 11 12:51:19.952679 2018] [cgi:error] [pid 4082] [client xxx.xxx.xxx.xxx:55721] AH01215: : /usr/local/cpanel/cgi-sys/ea-php71, referer: https://clients.exampledomain.com/invoices
[Thu Oct 11 12:51:19.952694 2018] [cgi:error] [pid 4082] [client xxx.xxx.xxx.xxx:55721] AH01215: mmap() failed: [12] Cannot allocate memory: /usr/local/cpanel/cgi-sys/ea-php71, referer: https://clients.exampledomain.com/invoices
[Thu Oct 11 12:51:19.952900 2018] [cgi:error] [pid 4082] [client xxx.xxx.xxx.xxx:55721] AH01215: PHP Fatal error:  Out of memory (allocated 33554432) (tried to allocate 585728 bytes) in Unknown on line 0: /usr/local/cpanel/cgi-sys/ea-php71, referer: https://clients.exampledomain.com/invoices

Domain and IP censored.

The server has plenty of available RAM, and for testing I increased the PHP limit to 512MB, to no avail. Any ideas?

Not sure, maybe try increasing the memory limit further?

You may want to check the limit is being used with a phpinfo page.

memory_limit 512M 512M
Memory limit confirmed to be working properly via phpinfo().

I also tried 1024MB, still no change. memory_limit applies to each script running, so I can’t imagine it would need anywhere close to more than 512MB. If it did, there’s a problem somewhere else.

Also, I’ve tried PHP 7.0 and 7.1.

Maybe the info here will help…

https://stackoverflow.com/questions/12015569/fatal-error-out-of-memory-but-i-do-have-plenty-of-memory-php

Setting MaxRequestsPerChild to 1000 (as opposed to a default of 10000 in Apache2.4) appears to resolve the issue.

Note: Apache 2.4 and up refer to this directive as Max Connections Per Child and ThreadsPerChild is referred to as Max Request Workers.

Thanks for the direction.

Glad to hear it’s working, thanks for sharing the solution!