9

I'm having an issue in WordPress where PHP is dying. I've increased memory, but the PHP process jumps to 100% CPU usage then dies and Apache throws a 500 error.

I've tried to get Apache to log something, or PHP/MySQL to log an error but nothing is logged other then a general 500 error.

The 500 issue is on the list page e.g.:

/wp-admin/edit.php?post_type=artist

We currently have over 1200 artist entries in WordPress, if I append a date sort like this:

/wp-admin/edit.php?post_type=artist&orderby=date

Then the list loads up fine, fast even! I have sat and watched the MySQL query log and it appears that WordPress is loading up the meta data for every single post (all 1200 of them) in order to produce the list of 10 or so. For just one of the queries, that's returning 92000 rows. I'm using Advanced Custom Fields and a template with its own framework, so each post has a fair chunk of meta data attached. I'm thinking that this is too much data for PHP to process and I'm hitting a ceiling here. The 1200 posts is likely to double easily over the next year.

How can I either force the initial page load to append the date sort or fix the issue with loading up all that meta data?

  • Have you tried disabling ACF and any other plugins? I think I once had a similar issue and I think that the culprit here isn't WP itself but with ACF. e.g. ACF adds meta data to revisions and then loads all that too. Please make sure what is the source of this issue as it will help other people helping you. – kraftner Apr 15 '16 at 13:15
  • Hey @kraftner ive disabled ACF and it has not made any difference. – Paul Cullen Apr 15 '16 at 15:58
  • How much memory are you using on wp-config (WP_MAX_MEMORY_LIMIT )? What is your PHP.INI value for memory_limit? Try raising them to the maximum. Also, I would take a look at your mysql configuration file. – Emanuel Rocha Costa Apr 18 '16 at 4:30
  • Ive raised PHP and WP_MAX_MEMORY_LIMIT both to 512 temporarily to no effect. My mysql config file is: default-storage-engine=MyISAM innodb_file_per_table=1 max_allowed_packet=268435456 open_files_limit=10000 query_cache_size=64M log_slow_queries = 1 log-slow-queries=/var/log/mysql.slow.log log-error=/var/log/mysqld.log general_log_file = /var/log/mysql_general.log – Paul Cullen May 13 '16 at 12:35
  • 1
    is the custom post type "artist" hierarchical (like pages)? .. if so this might be the culprit as all posts will be queried in the admin dashboard. If your application allows you could try changing hierarchical to false for the "artist" CPT and see if that alleviates the memory issues – locomo Jun 13 '16 at 14:18
1

Try changing hierarchical: false in your CPT definition (if your application allows).

When CPT's are set to hierarchical: true all posts will be queried in the admin dashboard which can cause memory issues.

0

The problem was that the CPT was set to hierarchical, switching this to hierarchical: false in the functions.php resolved the problem.

  • 1
    Please accept your own answer, so this question can be closed. – cjbj Jun 14 '16 at 15:18

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.