Select Page

Prestashop Error 500 – Top 7 reasons, and how to fix them

“500 Internal Server Error” or plain “Internal Server Error” is common in Prestashop installations.

As a Server Administration Service provider, we’ve seen a wide range of reasons for this error in Nginx servers, Apache, IIS, LiteSpeed and more.

It can range from Memory limits and File permission issues to obscrure Deadlock errors and Cache issues.

Prestashop error 500

Here’s what an HTTP error 500 looked like in a Prestashop hosted in Nginx.

 

What is HTTP 500 Internal Sever Error?

500” is an universal error code used by all Web Servers to say, “Some error happened. I have no clue what!

Yeah, not very helpful.

But, the HTTP error logs can (and often will) show you what has gone wrong.

 

How to troubleshoot Error 500

Every web server will have an error log.

For Apache servers, it is usually located at /var/log/apache/error.log. It will show you something like:

[Wed Apr 18 12:59:12.862338 2018] [php7:error] [pid 3538] [client XX.XX.XX.XX:31504] PHP Fatal error: Out of memory (allocated 2097152) (tried to allocate 59462712 bytes) in /home/myuser/public_html/classes/Configuration.php on line 206

Again, not very helpful unless you know what these numbers mean.

Now, let’s look at another option.

 

Troubleshooting Error 500 in Prestashop

In Prestashop, you can also get some additional information by turning on error reporting in the file “config/defines.inc.php

  • For Prestashop v1.5.2 and lower, change @ini_set('display_errors', 'off'); to @ini_set('display_errors', 'on');.
  • For Prestashop v1.5.3 and higher, change define('_PS_MODE_DEV_', false); to define('_PS_MODE_DEV_', true);.

Then take the page that gave you the error once more, and you’ll see something like this:

[PrestaShopDatabaseException]
Db->executeS() must be used only with select, show, explain or describe queries at line 471 in file classes/db/Db.php
465.
466. // This method must be used only with queries which display results
467. if (!preg_match('#^\s*\(?\s*(select|show|explain|describe|desc)\s#i', $sql))

OK, that can look scary too.

 

Just tell me how to fix this

Now, if you are like most website owners, you’ll want to know what are the common reasons for this error, so that you can try out some solutions yourself.

Don’t worry, we have you covered.

Here we have the top 7 reasons why you’ll get this error, and what you can do to fix them.

 

1. Low PHP Memory Limit

The most common reason we’ve seen for error 500 is low memory limit for PHP.

Many web hosts set the default memory allocation for PHP as 32 MB, 64 MB or 128 MB.

However, Prestashop requires at least 128 MB to function, and throw in some more for add-ons if you need them.

So, a sensible memory allocation is “256 MB”. If you have a VPS, set it to “512 MB”.

 

How to increase PHP Memory Limit

There are many ways to increase PHP memory size.

Some hosts provide web administration interface. Some allow command line access.

Here’s one way that we’ve seen to be working for many:

  • Login to your FTP account.
  • Download .htaccess file.
  • Add the line php_value memory_limit 512M in the file, and save
  • Re-upload the file.

If you are not sure how to do this, or if editing is disallowed in your account, our Prestashop experts can help you fix this. Click here to submit a support request. We are online 24/7.

 

2. Wrong file & folder permissions

Some servers that have SuPHP or Fast-CGI enabled can be especially sensitive to file and folder permissions.

The right permissions for files is 644 and folders is 755.

If you see from the server logs or Prestashop error report that file permissions maybe the issue, try resetting the permissions using the commands:

find /home/USERNAME/public_html -type d -exec chmod 755 {} \;
find /home/USERNAME/public_html -type f -exec chmod 644 {} \;

Replace /home/USERNAME/public_html with the path to your web directory.

You might also do this from an admin front-end (if you are provided with one).

Warning : Take a backup of your site before you execute any command.

If you are not sure how to reset the file and folder permissions, click here to request support. Our Prestashop experts are online 24/7.

 

3. Corrupted files or wrong encoding

Many Prestashop owners come to us saying the site broke after they tried to change something.

We’ve seen that often these issues are caused by incorrect file encoding or stray spaces that’s inserted while editing the files.

If you are not a web hosting expert, the best way to solve this is to download a fresh copy of Prestashop, and replace recently changed files.

If you’ve made extensive changes to your files, you’ll need to manually check the file formats and comb for syntax errors.

If you find that difficult, don’t worry. We can do it for you in a few minutes. Click here to open a support request to our Prestashop experts. We’re online 24/7.

 

4. Coding error in recently installed/updated module or theme

Prestashop addons (themes and modules) help you setup a shop just like you imagined.

But the downside is that some of these themes and modules might not be well maintained.

Many times we’ve seen some module using deprecated functions, or incorrect code, causing Prestashop to display the white screen.

So, if error 500 was shown after you recently installed or upgraded a new addon, try deleting that addon folder from backend. It should be located in the /themes/ or /modules/ folder in your Prestashop’s public_html.

If you are unable to find out which addon caused the error, we can fix that for you. Click here to open a support request to our 24/7 Prestashop support team.

 

5. Missing PHP modules

A common issue we’ve seen with Prestashop sites in VPSs is that they lack all the needed PHP modules.

For Prestashop to function, it needs:

  • Mcrypt
  • OpenSSL
  • Zip
  • Curl
  • GD
  • PDO

To check if these modules are enabled for your website, copy the below code into a file called phpinfo.php and upload it to your site. Then take it in a browser, and check for these extensions.
<?
phpinfo();
?>
If any of those modules are missing, check your server’s php.ini to see if it is enabled. If not, you’ll need to install them.

Installing modules can get a bit technical. If you suspect PHP modules are missing in your server, click here to request support from our Prestashop experts. We can fix that for you in a few minutes.

Note: Remember to delete the phpinfo.php file once you are done. Hackers could use that to target specific vulnerabilities.

 

6. Database connection limit

Some users have reported the error : “PrestaShop Fatal error: no utf-8 support. Please check your server configuration“.

This might look like UTF-8 support isn’t enabled in the server.

But in reality, it is just Prestashop unable to run a database query.

Some servers have database query limits (eg. 10,000 queries per hour). Any query above that limit wouldn’t be sent to the MySQL database, and it’ll show the UTF-8 error.

Of course it is also possible that the UTF-8 encoding in your database might be changed due to some reason.

If you have a VPS, you can fix this by changing the max_questions variable in the MySQL configuration file to 0 (means unlimited).

If you need help fixing the database limits, our Prestashop experts are online 24/7. Click here to open a support request.

 

7. Stale cache, incorrect .htaccess and many others

OK, this is not exactly ONE reason. This point exists to say there could be a lot more other reasons why Error 500 can happen.

Some of them are:

  • .htaccess errors : Syntax errors in .htaccess files, especially those used to pass PHP variables can cause compilation errors.
  • Security settings : Some security settings such as mod_security limits can cause the execution to fail. It’ll need to be found out by looking at the web server logs.
  • Many more : Basically anything that blocks the proper execution of Prestashop files can cause this error. If none of these seem to fit your issue, you’ll need to enable Error Reporting.

 

None of these fixes worked. What now?

There’s good news and bad news.

Bad news is that you’ll really have to geek out the cryptic log files.

Good news is that, you really don’t have to.

Here at Bobcares, our Prestashop experts do this kind of troubleshooting all day long.

It’ll take us only a few minutes to go through the logs and zero in on the solution.

So, if you need help, click here to get a Prestashop expert to look into your site. Yes, we are online 24/7.

 

Conclusion

Prestashop error 500 can happen due to PHP memory limits, file permission issues, database connection errors, and more. Here we have listed the top 7 reasons for this error, and how you can resolve it yourself.

 


Submit a Comment

Your email address will not be published. Required fields are marked *

Bobcares
Bobcares is a server management company that helps businesses deliver uninterrupted and secure online services. Our engineers manage close to 51,500 servers that include virtualized servers, cloud infrastructure, physical server clusters, and more.
MORE ABOUT BOBCARES