0

I'm looking at a Wordpress WooCommerce CSV export plugin. It works fine, except that if I ask it to export more than about 2000 records, something seems to be timing out and I get a 500 (not a 503, although the response body looks like it was made for 503s) after about 31 seconds.

My PHP installation is running on apache. Some things from my apache conf:

Timeout 300

<VirtualHost *:80>
  ServerName example.com
  ...
  CustomLog /var/log/httpd/example.com-access.log
  ErrorLog /var/log/httpd/example.com-error.log
  LogLevel debug
</VirtualHost>

And select lines from my php.ini:

max_execution_time = 300
error_reporting = E_ALL
display_errors = On
log_errors = On
log_errors_max_len = 4096
ignore_repeated_errors = Off
error_log = /var/log/httpd/php_errors.log

And the last line in my .htaccess:

php_value max_execution_time 300 # just in case
  • The access log declared httpd.conf (using the CustomLog directive) logs the IP, request URL, response code, and user agent string for all requests, but nothing else.
  • The error log declared in httpd.conf has nothing but lines that look like:

[Thu May 07 15:33:24 2015] [debug] mod_headers.c(743): headers: ap_headers_output_filter()

  • The error log declared in php.ini is an empty file, even after giving it chmod 666 or chowning it to apache:apache

I can't figure out why it appears to be timing out (judging from when it occurs), and why it gives a 500 instead of a 503 if it's a timeout, and why there is nothing in the error logs if it's really running into a 500.

Did I do something wrong? What can I do to diagnose this?

  • For anyone interested in my particular problem, it turns out that wordpress queries are gigantic memory leakers, and should not be used for things like generating CSVs. – user98149 May 8 '15 at 21:38
0

Try upping memory_limit in your php.ini, it's probably running out of room to store the export and then getting stuck and eventually timing out.

The entry on my Centos 7 server (php 5.4) looks like this:

; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
memory_limit = 1024M

It's set to 1024M for Drupal.

|improve this answer|||||
  • Turns out it was a memory problem. I tried changing memory allocation in php.ini before I posted the question and the 500 was occurring at the same time, so I figured it wasn't a memory problem. It turns out that this setting was being overridden in the local .htaccess file. – user98149 May 8 '15 at 21:29
  • Ahah! Glad you fixed it =) – Darvanen May 9 '15 at 0:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy