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.
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)
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 )
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 ) );
259
260 if ( !is_resource( $image ) )
261 return sprintf(__('File “%s” is not an image.'), $file);
262
263 return $image;
264 }
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.