Jump to content

Problem uploading images


Recommended Posts

Hi,

i'm getting this error Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 10080001 bytes) in /home/fsolent/public_html/prestashop/images.inc.php on line 155

I tried to look for the line and fix it but nothing. Help would be appreciated

Link to comment
Share on other sites

The issue here is that your PHP server configuration has a lower maximum RAM usage set than that needed by PrestaShop during the resizing process. Currently yours is set to 32MB from the error message (which is not unreasonable). My question would be whether you can upload even very small images (try something 1K or 2K in size as a test) or if this occurs with every image resize attempt regardless?

If it happens for everything then the issue is that the way things are organized internally in PrestaShop is going to use a lot of RAM and require a larger memory_limit set for the server or at least your directory via a .htaccess file (assuming your host allows this). But it could just be that you are uploading a far too large image and that if you resized it first you would not have this problem.

Cheers

Link to comment
Share on other sites

If these are JPEGs, a 500KB file translates to around 11MB when uncompressed in memory. Keep in mind that JPEGs are compressed files and you also need to deal with the rest of the codebase's objects being in RAM too.

You could try bumping up the maximum memory allowed for PHP to 64MB.

This can be done via the php.ini file for the host (remember to restart Apache after changing this) or via a .htaccess file:

php_value memory_limit 64M

You could also try adding the following to one of the bootstrap files for PrestaShop:

ini_set('memory_limit', '64M');

Keep in mind your server may have this config option disabled for you. A way to test would be to set up a simple script like this:

<?php
ini_set('memory_limit', '64M');

phpinfo();
?>

Search for "memory_limit" and see what it is set to - if it says 64MB then you will be good to go to make the change. If it is still 32MB then you are probably out of luck unless the host will change the default for you.

Cheers

Link to comment
Share on other sites

Assuming you are on a UNIX / FreeBSD / Linux based host running Apache as the webserver, take a look for a file called ".htaccess" in your web root. If not already there, add a line at the top of it that looks like this:

php_value memory_limit 64M

If you get a "500 internal server error" after that then your server does not support this option via .htaccess so remove that line.

If you cannot do it that way then you would need to edit "/config/config.inc.php" and add at the top by the other ini_set() calls this:

@ini_set(‘memory_limit’, ‘64M’);

If you are on a Windows based host, for what it is worth you have my sympathies.

=)

Cheers

Link to comment
Share on other sites

Create a new script (call it something unique and give it a ".php" extension) and put this in it:

<?php
ini_set(‘memory_limit’, ‘64M’);

phpinfo();
?>

Then call that page in your web browser. Search for "memory_limit". If it says anything less than 64M then your web host will not allow you to change the default memory limit.

Who is your web host? Also some sites like GoDaddy for example cache .htaccess files so it can take a bit before changes take effect.

Cheers

Link to comment
Share on other sites

For security reasons it is best if you make up the name yourself and do not give it out (and delete the file when you are done). Anything as long as it ends with ".php" and that does not already exist will work ("1234.php" for example). Upload it to your web root, i.e. the same level as where your store's "index.php" file is located.

Then call it in your web browser:

http://www.funnysides-website.com/1234.php

This will show the PHP settings for your webhost.

If you can't change the value try posting to the meekhost support forums asking how to bump up the memory limit for PHP.

You still have not said though whether no image resizing works or whether a really small image makes it through the resizing process OK.

Cheers

Link to comment
Share on other sites

×
×
  • Create New...