MediaWiki exhausting PHP's memory limit while uploading file
I have a basic MediaWiki installation running on a server. When I try to upload a file, I get the following error:
Fatal error: Allowed memory size of 20971520 bytes exhausted (tried to allocate 131072 bytes) in /var/www/wiki/includes/BagOStuff.php on line 404
The line to which this is referring is:
function _serialize( &$data ) {
$serial = serialize( $data );
if( function_exists( 'gzdeflate' ) ) {
return gzdeflate( $serial ); // line 404
} else {
return $serial;
}
}
The strange thing is, the upload seems to actually work fine; after the error, navigating to the file's page shown it having been uploaded. Furthermore, the error only occurs when uploading a new file, and not when updating an existing file.
This happens even using quite small image files, and even when PHP's memory limit is incre开发者_JS百科ased up to 512M, so a memory problem per se seems unlikely. Is gzdeflate having trouble with the serialized file for some reason?
Which version of MediaWiki are you using, and have you checked your LocalSettings.php? For 1.15 and earlier, there's a line in there by default that overrides your php.ini:
ini_set('memory_limit', '20M');
And try adding phpinfo() to the end of LocalSettings, not a standalone file, so it shows the status after MW initialization.
精彩评论