Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I dont know how/why this happened. I was working on my site over the weekend and it was fine. When I came into the office this morning, I went to the site and got this:

Fatal error: Allowed memory size of 146800640 bytes exhausted (tried to allocate 57 bytes) in public_html/wp-includes/rewrite.php on line 1561

I searched and found some articles that offered solutions, but none of them worked for me. What I noticed that the file that is effected is usually different in each case. Mine happen to be the "rewrite.php" file. That might help. Other than that Im stumped.

I know the customer complaints are coming. Hopefully I get it fixed soon.

What would be causing this, so I know not to repeat it (if I did cause this). Can anyone help with this?

UPDATE

I defined the memory limit in the wp-config.php to 64M and the line reference in the error is now 836 instead of 1561.

This is the code for line 836:

if ( is_array( $uris ) ) {
            foreach ( $uris as $uri => $pagename ) {
                $this->add_rewrite_tag('%pagename%', "($uri)", 'pagename=');
                $rewrite_rules = array_merge($rewrite_rules, $this->generate_rewrite_rules($page_structure, EP_PAGES));
            }
        }

UPDATE

I fixed the problem. The problem was somehow related to the permalink settings. Im using the CouponPress theme for wordpress. After increasing the memory limits, as suggested in most of the solutions (php.ini, wp-config.php, etc), I simply changed the permalinks to default and then back to my custom permalink. Everything seems to be back to normal. Why did this happen? I have no idea. All of sudden the error came up Monday morning and everyone was crazy (angry). I WOULD like to know what caused this, so I can prevent it in the future if I can. Thanks to everyone who helped me out with actual solutions.

share|improve this question
    
"I was working on my site over the weekend" ... what were you working on; what did you change? Also, what plugins are you using, what theme, what core hacks (if any), and what are you doing when this error occurs? –  EAMann Nov 28 '11 at 20:10
    
I was working on a custom pagination plugin. But I don't think that would be the problem because after saving my changes, the site was still working AND just in case there were any changes that mightve cause it, I cleared the whole php file and left it blank, but Im still getting the error. And the admin section isn't working either. –  user1893 Nov 28 '11 at 20:38
1  
Essentially, this error crops up because your server is running out of memory to allocate to PHP and WordPress. If you're on a shared host, it could be a poorly configured machine. But since this just started happening, it's likely been caused directly by changes you've made. So without knowing a) exactly what you changed and b) exactly how your server is set up, there's not much we can do. I suggest you find and hire a server/WordPress professional to take a look at your specific situation. As is, this is too localized for the site and I vote that it be closed as such. –  EAMann Nov 28 '11 at 22:32
add comment

2 Answers

Open your wp-config.php and make sure it has the following placed inside of it:

define('WP_MEMORY_LIMIT', '64M');

I've received similar errors and this fixed it.

share|improve this answer
    
Thanks Jeremy, I tried that but still get the error. The only thing that changed was that the line reference in the error is now 836 instead of 1561. I updated my post with the code for line 836. Thanks a lot –  user1893 Nov 28 '11 at 21:05
add comment

There really is nothing anyone here can do for you with such limited information. It is obviously something within your recent changes.

If you use a version control system (as everybody really should), I would roll back the changes and then from there slowly re-implement the changes that were causing this error to track it down and get rid of it.

share|improve this answer
    
Hi Kevin, thanks...what is a "version control system"? –  user1893 Nov 28 '11 at 21:09
1  
lmgtfy.com/?q=version+control+system Git git-scm.com, Subversion subversion.tigris.org CVS ximbiot.com/cvs Most popular hosted platform would be github.com. –  Kevin Langley Jr. Nov 28 '11 at 21:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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