I have a peculiar problem. When I'm uploading a photo to a website I have which runs on Wordpress on a MySQL database I am getting a "Fatal error memory size exhausted" message. However, it only happens on one PC. It works on other PC's.
I've tested it on all browsers and on a few different machines both apple and pc. It's always the same result on this one pc.
What must I change on this pc to make it work?
There is a setting in php.ini called "memory_limit" which determines how much memory a script can use, it's probably set lower on the one server
This is a local pc I'm talking about. Not sure if i made that clear. If its working on every other computer I use is it not likely to be a local issue.
I don't have a php.ini file in the given directory on the server and it says on the upload page the photo upload limit was 8mb. The file I'm testing with is only 2mb.
Do I still need to create a php.ini file on the server even if this issue is only happening on one of my computers.
Actually, if it's working on every computer except that one, it's.... almost certainly a local issue? That being the definition of local issue and all.
But let's just rule a few things out. Stop me if I make a mistake here.
1: You're uploading the same file from multiple computers to a single server running a single script.
2: The file in question is below 2 MB in size
3: You are not attempting to upload more than 8 MB in -total- in a single pageload.
How much memory is the error showing that the script is limited to, and how much is it attempting to allocate?
(PS: Flagging this for movement to the PHP forum, as the issue appears to be a PHP generated error rather than a DB generated one)
It's ANY photo attempted from the affected PC. I tested on other PC's with 2 of the affected photos and both were 2mb or under.
I only ever uploaded one at a time so no more than 8mb in one single action.
So... Single file, single script, single server and it works on all but one PC.
The allowed memory size is 134217728 and its trying to allocate 19772 in one of the images (which is a 1.9mb photo).
What difference in any is there in hardware, OS or web browser between the computers where it works and the one were it doesn't?
So it's allowed 128 MB for execution and it's capping it out. Sounds like there's a leak somewhere, unless it's trying to load all the pictures in the directory at once.
Is the page in question a WordPress-provided one, or a custom one?
(Phoenix and I will come at this from opposite ends, and probably meet somewhere in the middle )
Hi there StarLion,
Yes it is a wordpress standard page, not one I have coded myself. It's media.php which is located in the wp-includes folder of a standard wordpress install in case you're interested. And it's line 258. Here is that chunk of code in case you wanted to see it.
256 // Set artificially high because GD uses uncompressed images in memory
257 @ini_set( 'memory_limit', apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT ) );
258 $image = imagecreatefromstring( file_get_contents( $file ) );
260 if ( !is_resource( $image ) )
261 return sprintf(__('File “%s” is not an image.'), $file);
263 return $image;
SpacePhoenix, I'll try to find out the hardware differences. But it's not my PC that it doesn't work on - it's a client. This is for a website I am developing. I have tested it on 3 of my owm machines (all different configurations and browsers) and he has tested it on both of his (One is a PC and the other is an iMac - it works on the Mac).
I know he is using Google Chrome - But I have also tested it with chrome so I don't think that's the problem. Both of us use the same (up to date) version.
That's all of the information I have for now - I will try to get more.
So the line right before it is the one that grabs my attention.
@ini_set( 'memory_limit', apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT ) );
have you checked this value (WP_MAX_MEMORY_LIMIT) to make sure its not accidentally set too low?
This topic is now closed. New replies are no longer allowed.