Updating beyond WordPress 4.2.1 yields “allowed memory size exhausted”

I have a Windows Server running Plesk that has several WordPress sites. The PHP version on each is 5.5.26.

One, which uses the defaults for PHP, updates to the latest (4.2.3) with no issues, while the other sites, trying to update to 4.2.2 and now 4.2.3 yields the error message:

PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 65488 bytes) in C:\Inetpub\vhosts\butterflyvista.com\subdomains\pastrychefblog\wp-admin\includes\file.php on line 159

Yes, I did research on this error and know the recommended solutions. There are a number of pages on this topic, this one being one of them; and others two, three. Here are some interesting tidbits from this error message:

The Plesk/PHP default is 128M. Updating the limit to 256MB does nothing. Updating the site to 512MB also does nothing. The update process requires nowhere near this space.

Yes, I did an edit of the wp-config.php file and set

/** Memory Limit: Increase to avoid update errors. */
define('WP_MEMORY_LIMIT', '512M');
define('WP_MAX_MEMORY_LIMIT', '512M');

Note: default values are 128M and 256M. I also updated the memory_limit for PHP to 512M, up from 128M.

The failure has nothing to do with content, as I am debugging this problem on one of my test sites that has no comments, no pages, and no posts, so database entries are at zero. I deactivated and then deleted all the plugins, and removed all the added themes.

I added the PHP Error Widget to help with the issue and that merely just wrote my exact same error to the log file, so no help there. As far as I can tell, there is no WordPress error logs. EventViewer would not be helpful here.

I do not think that I have a corrupt installation. Too many other people have this exact same issue. I know that my server is fine, as another site updates fine, different domain on the server, but updates fine. I checked the Hosting and PHP settings between the working site and non-working sites, and saw no difference.

I do not think based on other people’s attempt that a manual installation would do any good. My issue is that I want to figure out what causes my particular issue and how to positively resolve the automatic update process.

It really does seem a bug with WordPress that occasionally turned up. The problem is with v4.1+, as others complain that since that version the problem started. I was okay up until and including 4.2.1.

As far as working and not working goes, here is a good one and here is a site that does not update. Other people asked about links on other similar posts, so I include that here, but looking at a nicely running WordPress site does not show anything, I think, as the problem is in the WordPress internals, possibly.

One thought that crossed my head is permissions, but I checked that and WP is major awesomeness in reporting permission problems.

Thoughts? Did I leave something out in testing/debuggin?

Solutions Collecting From Web of "Updating beyond WordPress 4.2.1 yields “allowed memory size exhausted”"

Edit line 149 in file.php as described in this thread:

fixed it for me (on a linux host).

edit: just read you are on windows: someone also posted a fix that applies to windows hosts there (apparently more complicated because backslashes are used in filepaths).

so your line 149 in file.php should read:

if ( empty( $filename ) || '.' == $filename || DIRECTORY_SEPARATOR == $filename ) {

good luck 🙂