Jump to content

Ideas for 500 internal server error


Kami Solutions

Recommended Posts

Hi,

 

I'm having headache with this error. I've tested prestashop for a while and the only 500error that prestashop could made is because the scripts that prestashop runs is over 30seconds or what you have setted in your php.ini file (i have a MAX of 30). This is really frustrating, because when I try to upload 1000 products in a simple csv with images, it's just terrible.

 

In prestashop 1.5.6 I could upload 5 products with 8 images per each product, and then gives me the 500 error (timeout). But now, in prestashop 1.6 it's insane, just 2 pictures or 3 and timeout.

 

In fact these images are big (1000x800) but, they are at most, 100kb each (i used RIOT to compress the images by weight), both 1.5 and 1.6 , and even with the watermark module (i use png instead of jpg).

 

Since I can't force to set my max_execution_time over 30 seconds, I have to start thinking in something else. Testing and all this, i can upload all the products in 10 seconds, with images but with no watermark, so i have to regenerate the thumbnails......

 

And yes, i get 500 error because of the images.... if you repeatedly run the scrip and unchecking the option "erase previous images" you cand do the thumbnails, but it's far too slow... in 1 hour with a script refreshing the webpage to force execute the script ran out of cpu of my host... and blocked me cpu power, so....i need to think in other solutions.

 

The possible solutions are:

 

1- Change hosting that has no restrictions with php.ini file

 

2- Checking PS forum some people say to backup my entire shop and upload it on localhost and regenerate the thumbnails

 

3-The option that i would like to do, create a script by chunks, that executes from last iteration of the loop(don't know if even is possible) or, create a regeneration of thumbnails by product ID or category ID or whatever.

 

I gues the second one is just good. Or, another idea would be optimize the thumnbail regeneration to be faster, but imagine a shop with 40000 images, it would take error 500 timeout anyways...

 

I'm scraching AdminImagesController.php the function _regenerateThumbnails() and _regenerateWatermark() but i have no clue of how to do this by chunks....

 

Someone has an idea or could help me?

 

Thanks

Link to comment
Share on other sites

if you know the code that is timing out, on some hosting you can circumvent this issue with this little php code.

set_time_limit(0); 

put at the start of the loop, or end or top/middle/end..:)

 

tip: good cloud hosting packages support deferred processing for long running, i.e. back ups etc.  not that old web appls are capable yet of running them as they are designed for legacy shared/vps/dedicated.  Mainframes handled this with dealy/defer processing off cpu loop.  working in constrained legacy hosting is a burden to all. :)

Link to comment
Share on other sites

I find it surprising that even with a 30sec timeout limit you're facing such restrictions. How are you importing the images? Via a url?

 

Another option might be to run the product import as a cron job. Command line utilities aren't time limited in the same way as interactive scripts, although depending on your hosting your jobs might still get killed if they take too long.

Link to comment
Share on other sites

if you know the code that is timing out, on some hosting you can circumvent this issue with this little php code.

set_time_limit(0); 

put at the start of the loop, or end or top/middle/end.. :)

 

tip: good cloud hosting packages support deferred processing for long running, i.e. back ups etc.  not that old web appls are capable yet of running them as they are designed for legacy shared/vps/dedicated.  Mainframes handled this with dealy/defer processing off cpu loop.  working in constrained legacy hosting is a burden to all. :)

 

Thank's for the tip, i've tryied it and no effects, i think it's full blocked by my hosting... I think i have to work in a script by chunks, i think it's the best idea for now...

 

I find it surprising that even with a 30sec timeout limit you're facing such restrictions. How are you importing the images? Via a url?

 

Another option might be to run the product import as a cron job. Command line utilities aren't time limited in the same way as interactive scripts, although depending on your hosting your jobs might still get killed if they take too long.

 

I'm importing images via URL that are in my FTP account, for example:

 

 

 

 

 

The thing is it's not the import problem, the really thing is the thumbnails, because i've activated watermark module.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...