Web Design. Web Development. Web Hosting.
0 items

PrestaShop 503 Internal Server Error Paypal Module

Need some help? We are here for you!

We have a very friendly service - Come and chat to us and let us know what you need, we work for an hourly fee and can also provide you a no obligation quote and begin work immediately in most cases. Click "Request Support" or use our Live Chat.

Request support

One of our clients was having serious issues with their PrestaShop store, it would randomly start returning 503 Internal Server Error and would not come back up again, we found the only way to make the site work was to disable the PayPal Module and the site would magically start working again. To make things even stranger, if we re-enabled the PayPal Module again the site would continue to work for several weeks before the behaviour would repeat again. Eventually we managed to narrow this down to the following file: /modules/paypal/paypal_logos.php Open this file in a text editor and find these lines below, roughly line 134 (at the very bottom):

<?php
private function updatePictures($source, $destination, $force = false)
{
 
 $wrappers = stream_get_wrappers();
 $https_wrapper = in_array('https', $wrappers) ? true : false;
 
 // 604800 => One week timestamp
 if (!file_exists(_PS_MODULE_DIR_.$destination) || ((time() - filemtime(_PS_MODULE_DIR_.$destination)) > 604800) || $force) {
 $picture = Tools::file_get_contents($source);
 if ((bool) $picture !== false) {
  if ($handle = @fopen(_PS_MODULE_DIR_.$destination, 'w+')) {
  $size = fwrite($handle, $picture);
  if ($size > 0 || (file_exists(_MODULE_DIR_.$destination) && (@filesize(_MODULE_DIR_.$destination) > 0))) {
   return _MODULE_DIR_.$destination;
  }
  
  }
 } elseif (strstr($source, 'https')) {
  return $this->updatePictures(str_replace('https', 'http', $source), $destination);
 } else {
  return false;
 }
 
 }
 
 return _MODULE_DIR_.$destination;
}
?>

Comment out everything in this function and place a “return false;” like this:

<?php
private function updatePictures($source, $destination, $force = false)
{
 
 //$wrappers = stream_get_wrappers();
 //$https_wrapper = in_array('https', $wrappers) ? true : false;
 
 // 604800 => One week timestamp
 /*if (!file_exists(_PS_MODULE_DIR_.$destination) || ((time() - filemtime(_PS_MODULE_DIR_.$destination)) > 604800) || $force) {
 $picture = Tools::file_get_contents($source);
 if ((bool) $picture !== false) {
  if ($handle = @fopen(_PS_MODULE_DIR_.$destination, 'w+')) {
  $size = fwrite($handle, $picture);
  if ($size > 0 || (file_exists(_MODULE_DIR_.$destination) && (@filesize(_MODULE_DIR_.$destination) > 0))) {
   return _MODULE_DIR_.$destination;
  }
  
  }
 } elseif (strstr($source, 'https')) {
  return $this->updatePictures(str_replace('https', 'http', $source), $destination);
 } else {
  return false;
 }
 
 }
 
 return _MODULE_DIR_.$destination;*/
 return false;
}
?>

And now everything should work fine…

0 0 votes
Article Rating
Need some help? We are here for you!

We have a very friendly service - Come and chat to us and let us know what you need, we work for an hourly fee and can also provide you a no obligation quote and begin work immediately in most cases. Click "Request Support" or use our Live Chat.

Request support
Author: Dean WilliamsProfessional PHP Web Developer with expertise in OpenCart Web Development, WordPress Web Development, Bespoke Systems - also a seasoned Linux Server Administrator.


Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments


Share this page..

Let's begin your journey...

Get in touch us now to begin your journey to having a beautifully crafted mobile responsive website. If you're still unsure what we could do for you then take a look at our why us page which includes reviews, or take a look at our portfolio.

We can work on improving existing websites or craft a new stylish website making your business stand out.

You could always catch us by email, telephone, Skype or live chat to us below.


    0
    Would love your thoughts, please comment.x
    ()
    x