При разработке веб-сайтов и веб-приложений можно столкнуться с ошибкой 500 internal server error. Сначала она может испугать и ввести в заблуждение, поскольку обычно веб-сервер выдает более конкретные ошибки, в которых указана точная причина проблемы, например, превышено время ожидания, неверный запрос или файл не найден, а тут просто сказано что, обнаружена внутренняя ошибка.
Но не все так страшно и в большинстве случаев проблема вполне решаема и очень быстро. В этой статье мы разберем как исправить ошибку Internal server error в Nginx.
Дословно Internal server error означает внутренняя ошибка сервера. И вызвать её могут несколько проблем. Вот основные из них:
- Ошибки в скрипте на PHP — одна из самых частых причин;
- Превышено время выполнения PHP скрипта или лимит памяти;
- Неправильные права на файлы сайта;
- Неверная конфигурация Nginx.
А теперь рассмотрим каждую из причин более подробно и разберем варианты решения.
1. Ошибка в скрипте PHP
Мы привыкли к тому, что если в PHP скрипте есть ошибки, то сразу же видим их в браузере. Однако на производственных серверах отображение сообщений об ошибках в PHP отключено, чтобы предотвратить распространение информации о конфигурации сервера для посторонних. Nginx не может отобразить реальную причину ошибки, потому что не знает что за ошибка произошла, а поэтому выдает универсальное сообщение 500 internal server error.
Чтобы исправить эту ошибку, нужно сначала понять где именно проблема. Вы можете включить отображение ошибок в конфигурационном файле php изменив значение строки display_errors с off на on. Рассмотрим на примере Ubuntu и PHP 7.2:
vi /etc/php/7.2/php.ini
display_errors = On
Перезапустите php-fpm:
sudo systemctl restart php-fpm
Затем обновите страницу и вы увидите сообщение об ошибке, из-за которого возникла проблема. Далее его можно исправить и отключить отображение ошибок, тогда все будет работать. Ещё можно посмотреть сообщения об ошибках PHP в логе ошибок Nginx. Обычно он находится по пути /var/log/nginx/error.log, но для виртуальных доменов может настраиваться отдельно. Например, смотрим последние 100 строк в логе:
tail -n 100 -f /var/log/nginx/error.log
Теперь аналогично, исправьте ошибку и страница будет загружаться нормально, без ошибки 500.
2. Превышено время выполнения или лимит памяти
Это продолжение предыдущего пункта, так тоже относится к ошибкам PHP, но так, как проблема встречается довольно часто я решил вынести её в отдельный пункт. В файле php.ini установлены ограничения на время выполнения скрипта и количество оперативной памяти, которую он может потребить. Если скрипт потребляет больше, интерпретатор PHP его убивает и возвращает сообщение об ошибке.
Также подобная ошибка может возникать, если на сервере закончилась свободная оперативная память.
Если же отображение ошибок отключено, мы получаем error 500. Обратите внимание, что если время ожидания было ограничено в конфигурационном файле Nginx, то вы получите ошибку 504, а не HTTP ERROR 500, так что проблема именно в php.ini.
Чтобы решить проблему увеличьте значения параметров max_execution_time и memory_limit в php.ini:
sudo vi /etc/php/7.2/php.ini
max_execution_time 300
memory_limit 512M
Также проблема может быть вызвана превышением других лимитов установленных для скрипта php. Смотрите ошибки php, как описано в первом пункте. После внесения изменений в файл перезапустите php-fpm:
sudo systemctl restart php-fpm
3. Неверные права на файлы
Такая ошибка может возникать, если права на файлы, к которым обращается Nginx установлены на правильно. Сервисы Nginx и php-fpm должны быть запущены от имени одного и того же пользователя, а все файлы сайтов должны принадлежать этому же пользователю. Посмотреть от имени какого пользователя запущен Nginx можно командой:
nginx -T | grep user
Чтобы узнать от какого пользователя запущен php-fpm посмотрите содержимое конфигурационного файла используемого пула, например www.conf:
sudo vi /etc/php-fpm.d/www.conf
В моем случае это пользователь nginx. Теперь надо убедится, что файлы сайта, к которым вы пытаетесь обратиться принадлежат именно этому пользователю. Для этого используйте команду namei:
namei -l /var/www/site
Файлы сайта должны принадлежать пользователю, от имени которого запущены сервисы, а по пути к каталогу с файлами должен быть доступ на чтение для всех пользователей. Если файлы принадлежат не тому пользователю, то вы можете все очень просто исправить:
sudo chown nginx:nginx -R /var/www/site
Этой командой мы меняем владельца и группу всех файлов в папке на nginx:nginx. Добавить права на чтение для всех пользователей для каталога можно командой chmod. Например:
sudo chmod o+r /var/www/
Далее все должно работать. Также, проблемы с правами может вызывать SELinux. Настройте его правильно или отключите:
setenforce 0
Выводы
В этой статье мы разобрали что делать если на вашем сайте встретилась ошибка 500 internal server error nginx. Как видите проблема вполне решаема и в большинстве случаев вам помогут действия описанные в статье. А если не помогут, напишите свое решение в комментариях!
Статья распространяется под лицензией Creative Commons ShareAlike 4.0 при копировании материала ссылка на источник обязательна .
While trying to access a website or scroll down to any webpage, you must have encountered a 500 internal server error at some point. If you are a visitor, you would probably ignore it and would jump to another one.
However, a website administrator might have to pay heavily if he ignores it and sit relaxed without fixing it right there. With internal server error 500, not only the website front-end but the WordPress administrator dashboard might go inaccessible.
Here, we have come up with details across the reasons that instigate such errors and directions to fix them. Also, we are sharing insights on the importance of investing in a credible web hosting server to avoid a 500 internal server error and improve the website operating time.
In any case, if an HTTP 500 internal server error is re-occurring, it can dramatically impact the reputation of your business. Increased frequency of such an error may lead to your visitors losing trust in your firm and its services.
For the most part, it badly affects the branding and the search engine rankings of your website. Hence, experts advise avoiding this error and fixing it as soon as it occurs. They also recommend extensively understanding how to troubleshoot.
Many a time, it occurs due to internal WordPress issues with website configuration, while sometimes it can trigger due to a problematic server, which you may not find under your control.
What is a 500 Internal Server Error?
In general, the three-digit error status code starts with ‘5’ and looks like 5XX, for instance,500 (internal server error).
Such type of error shows that the server is not able to process the request due to incorrect website configuration, and there are no issues with the user’s request. It also indicates that there can be some issues the server has encountered within its framework.
While 500 — internal server error specifically designates that the webserver is undergoing some kind of an internal issue and could not process the user’s request at that moment. Sometimes it can be a temporary error and lasts for only a few minutes or maybe seconds.
However, if the problem persists longer than a few minutes, there is a high probability that the website has got some serious problems.
More often, it is found that these issues come into the picture when the website is incorrectly configured. In such a case, the website administrators can fix it at their end.
But if these errors are occurring very frequently, you should connect with a web server tech support team and find out how to fix a 500 internal server error. We have come across some popular 5XX error codes, including 502 Bad Gateway error, and 504 Gateway timeout error, and have helped our clients troubleshoot the issue within the stipulated time.
To know a specific kind of issue, you can look into the specific error code. We are providing some commonly occurring codes and the reasons for such:
Code List of Error 500 Internal Server Error
Code |
Why or How it occur? |
500.11 |
The application crashes on the webserver after a user agent’s request. |
500.12 |
The application undergoes a restart process on the webserver. |
500.13 |
The webserver gets overloaded with a large no. of requests or remains too busy with other requests. |
500.14 |
Invalid application configuration or the WordPress website installation is incorrect or corrupted. |
500.15 |
Direct requests for GLOBAL.ASA is not allowed. |
500.16 |
Incorrect UNC authorization credentials. |
500.17 |
Cannot find URL authorization. |
500.18 |
Not opening of URL authorization store. |
500.19 |
Improper Data Configuration for this file in the Metabase. |
500.2 |
URL authorization scope cannot be found. |
500.21 |
Unrecognizable Module. |
500.5 |
This code occurs due to a rewrite error during RQ_BEGIN_REQUEST notification handling. The error may arise due to a faulty configuration or inbound rule execution. |
Quick Tips to Avert a 500 Internal Server Error and Troubleshoot
-
In the first place and for the most part, you should keep all the plugins, themes, and WordPress Core updated. The outdated versions often create more issues and are relatively more prone to security threats (malware and hacking) than the updated ones.
-
It is important to take regular backups of the WordPress website files and database. For this, you can use a good plugin and easily restore the website to the desired version. Here, connecting with an experienced and adept web hosting service provider can help make a judicious decision.
-
Word Press admins must turn on ‘Debugging’. This small trick can help you easily debug the website, informing you vitally about the cause of the issue. You can allow debugging by adding this line of code in your word press-configuration file: “define( “WP_DEBUG”, true );”
-
Always use a highly reliable server.
-
You must use security plugins to scan and audit your website as and when required. Also, use reliable plugins and themes only to avail of good support.
As an acclaimed web server hosting company, we have a system to keep a close watch on the hosted WordPress websites and notify the website administrator.
You can use some free web-based website monitoring tools. Also, make sure to speed up WordPress so that users have the best experience possible. They also send notifications if the website stops functioning due to any reason.
Key Steps for Troubleshooting of 500 Internal Server Error
Step 1
Reload the web page. Many a time, it can be a temporary issue and gets resolved with reloading or refreshing the page.
Step 2
Use Ctrl + F5 and clear the cache. Additionally, you can browse history and clear the browser cache too.
Step 3
Try accessing the word press -admin backend of your WordPress installation.
Step 4
You should deactivate all the plug-ins if you get the flexibility to access the admin dashboard.
Step 5
You can switch the theme to the default one if you are not able to fix the 500 internal server error. Once it is resolved, you can update or change the theme.
Step 6
If the 500 internal server error persists, you must check the .htaccess file, file permissions as explained above.
Where you will find a 500 Internal Server Error?
-
HTTP 500 Error on a WordPress Website
-
500 Error on Linux
HTTP 500 internal server error on a WordPress Website
When a word press website encounters a 500 internal server error, visitors will not be able to access the website. In extreme cases, even the administrator may not be able to access the word press-admin backend.
You can come across the following messages: the browser will reflect any of the messages listed below:
-
“500 Internal Server Error”
-
“HTTP 500”
-
“Internal Server Error”
-
“HTTP 500 – Internal Server Error”
-
“500 Error”
-
“HTTP Error 500”
-
“500 – Internal Server Error”
-
“500 Internal Server Error. Sorry, something went wrong.”
-
“500. That’s an error. There was an error. Please try again later. That’s all we know.”
-
“The website cannot display the page – HTTP 500.”
-
“Is currently unable to handle this request. HTTP ERROR 500.”
Check Out Ways To Fix 500 Internal Server Error in WordPress
In case there is an error 500 — internal server error on your WordPress website, you may not access any or some of the website’s pages. This directs that there are some issues at the root directory.
Corrupt .htaccess file
A corrupted .htaccess file is among the most common issues or causes of a 500 internal server error. One can find this in the root directory.
This error might arise due to a plugin update, theme update, etc, which might have been incurred while migrating from one server to another. To fix this 500 internal server error, you can simply replace the current .htaccess file with another one.
Exceeding PHP Memory Limit
A 500 internal server error caused by exceeding the PHP memory limit usually occurs when any word press plug-in or theme is consuming processing memory more than required. This error could also take place if website administrators are using multiple plug-ins at a time.
To fix this issue, you can increase the memory limit. You can do this efficiently by allowing some modifications in the wp-configuration file or php.ini file. You can increase from 64M to 128M, 256M, and extend so on.
There is an alternative where you can enhance the PHP memory limit through php.ini. Also, you can edit your php.ini by selecting the line of code that defines the memory limit.
This may look like this: memory_limit = 32M, and you can extend this memory limit to 64M, 128M, 256M, and so on.
One more related issue with a 500 internal server error caused by exceeding PHP memory unit is the Maximum Execution Time. In such a case, you can exceed the maximum execution time limit either through a word press-configuration file, or .htaccess file or, a php.ini file.
You can add the following code to define the Maximum Execution Time using word press-configuration or increase its value if the code already exists:set_time_limit(300);
You can add or edit the following code to increase the time limit using the .htaccess file:php_valuemax_execution_time 300
You can use the following code to edit php.ini as well to increase the execution time:max_execution_time = 300.
Faulty Plugin or Theme Issue
With the recently installed or updated plugin, you need to check and analyze if there are any issues with those plugins causing a 500 internal server error.
In case, you can access the admin dashboard (if possible) and deactivate all the plugins at once. Refresh, and then check the website if it is working.
In case if it is working to reactivate the plugin one after the other, then check after activating each of the plugins. This way, you can easily detect which Word Press plugin is causing such an error.
Additionally, you can rename the directory of every plugin in case you cannot access the admin backend.
Meanwhile, you can check the website after renaming each of these and see if the 500 internal server error resolves or persists. Also, experts recommend updating all the plugins as and when required.
Furthermore, you can try updating or switching the theme of your WordPress Website. This can help you check if the internal server error is gone.
We often provide our customers with Error logs to help them further identify the cause of the error. If you wish to avail of such capabilities and avert a 500 internal server error due to a faulty plugin or WP theme, you can connect with us anytime.
Corrupted Core Files
To troubleshoot a 500 internal server error on your Word Press website caused by corrupted core files, you have to upload the updated files using an FTP server.
Also, you can upload the updated files from WordPress.com and use FTP software to upload them to the server.
Check File Permissions
WP administrators need to correctly configure all the directory and file permissions to make the WordPress website work perfectly fine and without a hitch.
File permission settings that experts recommend are as follows:
1. 755 for all folders and sub-folders.
2. 644 for all files.
Incorrect permission settings can block some plugins, themes, and scripts from working. Additionally, we can help you use the ‘Fix Permissions’ tool for fixing file permissions in Sites->Tools in the dashboard.
Unsupported PHP Version
Some of the outdated PHP versions are not supported by the latest WordPress version anymore. WP experts highly recommend the latest versions like 7.0, 7.1, 7.2, 7.3, and 7.4.
Also, we can let you have the latest PHP 8 version and managed WordPress Hosting without much hassle.
Incorrect DNS Entries
If your DNS (Domain Name System) is directed to a server other than your hosting server, your visitors cannot access it.
Therefore, it is crucial to make sure that your Domain Name System entries are accurate.
Problem with Server Itself
In any case, you cannot find the cause of a 500 internal server error; you should immediately connect with the technical support team of your web hosting provider.
There can be critical issues with either the server hardware or the software application. However, if outage reports are very frequent at the server end, it’s high time to consider switching to another company.
Linux 500 Error
In case the website visitors are encountering HTTP status 500 — internal server error, you can troubleshoot it using Linux.
This you can do if the error arises due to any of the CGI or PERL scripts. Also, your website can come across such an error due to the non-compatible versions of PHP and Apache. In this case, you must upgrade PHP or recompile Apache.
Ask a Web Hosting Server Administrator
In case you do not find any solution across your HTTP 500 internal server error even after using troubleshooting popular software or trying debugging server-side scripts.
You need to go through all the common and complex causes of such issues. In server documentation, a 500 internal server error may arise for different reasons in different operating systems.
Hence, you should comprehensively analyze your system and go for the most appropriate way to fix it.
Also, you can connect with your web hosting
service provider to troubleshoot this type of error. They can access your error
logs and identify key reasons for such problems.
The root cause of your
problem. These service providers closely monitor the issue, fix it within the
stipulated time, and help you with inventive tools to avoid such complexities
in the future, too.
Conclusion
For the most part, advanced strategy and support help you increase efficiency. It is the industry-best practice to connect with experienced administrators.
Many a time, troubleshooting a 500 internal server error can impact your website’s Google ranking. Before you plan to move ahead and fix this on your own, check if your server is still working. If it is not running, contacting your web hosting service provider should be on high priority.
Get InTouch
Connect with our Team of Experts for any Website Development Service
This is an Ancient answer from 2013, back when PHP was new and security wasn’t an issue:
Here in the future it’s a security risk to dump errors to screen like this. You better not be doing this in any production setting.
Why are the 500 Internal Server Errors not being logged into your apache error logs?
The errors that cause your 500 Internal Server Error are coming from a PHP module. By default, PHP does NOT log these errors. Reason being you want web requests go as fast as physically possible and it’s a security hazard to log errors to screen where attackers can observe them.
These instructions to enable Internal Server Error Logging are for Ubuntu 12.10
with PHP 5.3.10
and Apache/2.2.22
.
Make sure PHP logging is turned on:
-
Locate your php.ini file:
el@apollo:~$ locate php.ini /etc/php5/apache2/php.ini
-
Edit that file as root:
sudo vi /etc/php5/apache2/php.ini
-
Find this line in php.ini:
display_errors = Off
-
Change the above line to this:
display_errors = On
-
Lower down in the file you’ll see this:
;display_startup_errors ; Default Value: Off ; Development Value: On ; Production Value: Off ;error_reporting ; Default Value: E_ALL & ~E_NOTICE ; Development Value: E_ALL | E_STRICT ; Production Value: E_ALL & ~E_DEPRECATED
-
The semicolons are comments, that means the lines don’t take effect. Change those lines so they look like this:
display_startup_errors = On ; Default Value: Off ; Development Value: On ; Production Value: Off error_reporting = E_ALL ; Default Value: E_ALL & ~E_NOTICE ; Development Value: E_ALL | E_STRICT ; Production Value: E_ALL & ~E_DEPRECATED
What this communicates to PHP is that we want to log all these errors. Warning, there will be a large performance hit, so you don’t want this enabled on production because logging takes work and work takes time, time costs money.
-
Restarting PHP and Apache should apply the change.
-
Do what you did to cause the 500 Internal Server error again, and check the log:
tail -f /var/log/apache2/error.log
-
You should see the 500 error at the end, something like this:
[Wed Dec 11 01:00:40 2013] [error] [client 192.168.11.11] PHP Fatal error: Call to undefined function Foobar\byob\penguin\alert() in /yourproject/ your_src/symfony/Controller/MessedUpController.php on line 249
Many times Apache gives 500 Internal Server Error due to various reasons. In the article, we will look at what is 500 internal server error, why do you get this error message and how to fix 500 Internal Server Error in Apache localhost, CPanel other systems like Ubuntu, CentOS, Windows.
Apache gives 500 Internal Server Error when there is a server-side error that prevents Apache from processing a request and returning a proper response. This can be due to various reasons such as faulty code, inadequate file permissions, missing files referenced in code, etc. There are multiple ways to fix 500 internal server error in Apache.
Bonus Read : How to Install mod_deflate in Apache
How to Fix 500 Internal Server Error in Apache
Here are the steps to fix 500 internal server error in Apache on localhost, CPanel, PHP, Ubuntu, and other systems.
1. Hard Refresh the Page
The simplest way to fix 500 internal server error in Apache is to simply refresh the page. Sometimes you may be requesting a page when the server is being restarted. In such cases, you will get 500 internal error.
Sometimes, the server may be overloaded with requests and doesn’t have resources to process your request.
In both these cases, you can do a hard refresh to force the browser to connect to server and download the latest website content. You can do this by pressing
- Windows: Ctrl + F5
- Mac: Apple + R or Cmd + R
- Linux: F5
Bonus Read : How to Fix 504 Gateway Timeout Error in Apache
2. Examine Server Logs
Many times, you get 500 internal server error only for one page or a few pages but not all pages on your website. So it is important to check your server log to find the requests causing this issue.
Every server log records the requested URL along with the returned response. Among the most recent requests, look for the ones that have returned 500 response code.
This will tell which script is causing the issue. Once you have identified the script, open your browser and request this page again to confirm that it is indeed raising the error in server log.
3. Examine your script
Next, check if your script is working properly.
Is your script in the right place? Have you named it correctly? Is your URL mapping/routing referencing the right script?
If your script refers any file, then are the file paths correct? If they refer any function/program, have you referenced them correctly ?
Bonus Read : How to Fix 502 Bad Gateway Error in Apache
4. Check File/Folder Permissions
Did you modify any file/folder permission recently? Did you create a new file/folder in your code?
If so then you might be seeing 500 internal server error due to wrong file/folder permissions. Typically, files should have 644 user permission while folders should have 755 permission. You can use FileZilla (Windows) or CHMOD (Linux) to change file permissions.
Look at the permissions of other files/folders in your code and update the permission for your file/folder accordingly.
Bonus Read : How to Increase Request Timeout in Apache
5. Check .htaccess file
If you have set up URL rewrites or URL redirection, then you may have used .htaccess file. Make sure you have setup mod_rewrite correctly.
Also use a third-party tool to check URL rewrite syntax, and ensure they are correct.
Bonus Read : How to Enable mod_rewrite in Apache
6. Increase Script Timeout
If your Apache server depends on another external script/function to process a request and it times out, then Apache will return 500 Internal Server error.
So increase the timeout values of those external scripts so that they maintain the connection and return a proper response.
Hopefully, the above tips will help you fix 500 internal server error in Apache.
Ubiq makes it easy to visualize data in minutes, and monitor in real-time dashboards. Try it Today!
Related posts:
- About Author
One of the most common errors that occur when browsing the web is the “500 Internal Server Error”. This message indicates that the webserver is experiencing technical problems.
This article explains what a 500 error means, why you’re getting an HTTP 500 code, and how to troubleshoot these errors.
What is a 500 Internal Server Error #
Each time you open a web page, your browser sends a request to the server hosting the site, which returns the requested data and response code. The HTTP response status codes indicate whether the request has been successful or not.
Responses are categorized in five classes. The codes in the 500 to 599 range are indicating a server error.
The HTTP status code 500 is a generic error response that is returned by the server when no other error code is appropriate. It can be caused by a number of problems that prevent the server from completing the request.
If the page you are visiting throws 500 Error there is nothing much you can do since the error is not caused by your browser or Internet connection. Even though the error is on the server-side, you can try some of the following options:
- Reload your browser or try with another one. The chances that the page will load when you refresh your browser are low, but still, it’s worth giving it a try.
- Try to clear your browser cache. If the page that shows 500 error is cached, after the cache is cleared, the browser will request a new version of the page.
- Come back later. The webmaster may fix the server issue in the meantime.
- Contact the website owners. The last remaining option is to get in touch with the person responsible for maintaining the website.
Troubleshooting 500 Error #
- A permission issue. When the webserver has no permissions to access the site files, it may throw an HTTP 500 error. The solution to this issue is to change the website file’s permissions recursively .
.htaccess
syntax error. If you are using Apache as a webserver, then most probably you have a.htaccess
file in your site root directory. Invalid syntax or non-existing module directive can lead to a 500 error.- Database related issue. HTTP Error 500 can also be caused by incorrect database server information or a corrupted database.
- Issues with plugins and themes. If you are running WordPress or similar CMS, the 500 error can appear after updating or modifying a plugin/theme.
- Server issues. A corrupted filesystem or exhausted memory can lead to 500 error.
- Node.js modules. If you have Node.js based site, updating modules can cause a 500 internal server error.
- Hacked site. Quite often a malicious code that is injected into your website results with a 500 error.
- Incompatible module. Loading an incompatible PHP or Apache module throws the 500 error.
- External Resource Timeout. If the server communicates with external service and if those services are not reachable the server will show a 500 error message.
The best way to determine why the 500 error occurred is to check the server log files. The location od the log files depends on your Linux distribution and the web server. The most common locations for Apache and Nginx are as follows:
/var/log/apache2/error.log
/var/log/httpd/error_log
/var/log/nginx/error_log
If your application is built on Node.js, check the Node.js logs.
Typically the server log contain a detailed information about the error that will help you to identify and fix the error.
Conclusion #
The 500 Internal Server Error is a general HTTP status code meaning that something went wrong with the web server hosting the site you’re visiting.
If you have any questions or feedback, feel free to leave a comment.
Internal Server Error — Linux
When you try to access a website and you ended up with the internal server error then that should be due to the number of possibilities like apache server misconfigured or wrongly written access file and more. This type of error is mostly observed at apache servers. And it will be resolved with the proper configuration changes. The cause of this can be analyzed with the error log.
As a website owner it is not a good thing to see your website showing internal server error. Internal server error is a common error thrown by Apache web server in Linux web hosting India server. Like in any http error scenario the error code 500 means it is an internal server error. Generally internal server errors are caused due to something went wrong while processing your web page in the Linux server, could be due to various reasons for example if web server is not able to serve your request due to low disc space or low memory or web server is not able to create a new process to serve your request or it may be due to any coding issue or error issues in database connection. There are hundreds of possibility, why internal server error happening.
The best way to analyze your internal server error is, by looking at the error log of Apache. Often you find error log in your public_html folder. If you have disabled error display option in php.ini settings using Cpanel control panel then you will not see any error message in error log. So, first of all, to see what is a problem and why the internal server error is coming, you have to enable error display option in php.in using cPanel. Once you enable error display and warning display option in PHP and then try to access your website once again it might give the same 500 error, this time you check the error log for any possible coding issue. If there is any issue in your source code you can see the error in error_log, otherwise send the email to support team.
What is Internal Server Error Mean?
A server error means there is either a problem with the operating system, the website or the Internet connection. There are many different kinds of internal server errors, but a «500 error» is the most common. It is up to the operators of the Web server site to locate and analyse the logs which should give further information about the error.
Cause of HTTP 500 Errors:
Internal Server Error messages indicate that something, in general, is wrong.
-
A Permissions Error
-
A PHP Timeout
-
A Coding Error in .htaccess
How do I fix a 500 Internal Server Error?
Check the log to find the exact reason for Internal Server Error and resolve accordingly.
1) Take a look at your server log to take note of the content of this log file.
2) Do the action that triggers the 500 error
3) Now check the server log again for the additional content that went in there for this error. That will tell you what is going on and why the server gave this error.
It’s important to note that the server side of an application generates this error even though you may see the error code inside your browser. That means that your HTML, client-side JavaScript, or anything else that runs in a browser is not the source of a 500 Internal Server Error. Of course, the name does imply that it’s a server error, but systems have grown so complex today, that this reminder could be helpful.
Linux — Website Showing Internal Server Error
What is Internal Server Error
-
Internal Server error will occurs when your Linux Hosting Server setting or configuration in not setup properly. It occurs when you have issue internally in the server.
-
The 500 Internal Server Error is a server end error, meaning the problem probably isn’t with your computer or internet connection but instead with the website’s server.
-
Internal server has different types, which is shown in the below screen.
-
And if you are facing internal server issue, then you contact to the support team. Get Help From a Linux Hosting Server Administrator.
Why this issue happens
For the Internal server error, Most of the common reason is,
- CHECK THE ERROR LOGS!
- ERROR WITH AN .HTACCESS FILE
- PHP CODING TIMING OUT
- SYNTAX OR CODING ERRORS IN YOUR CGI/PERL SCRIPT
- PERMISSION ISSUE
- ERRORS IN SCRIPT
How can you prevent this from the future?
We can’t prevent from this issue, this issue occurs only when a manual mistakes done by client or server admin.
We can bring solutions to resolve the issue.
How to do in detail?
CHECK THE ERROR LOGS!
With any error message, particularly one as broad as the 500 Internal Server Error, you will first want to check any Apache and PHP error logs for your server. These logs can provide valuable context related to any code failures or other potential causes of a site failure.
ERROR WITH AN .HTACCESS FILE
If you are using a .htaccess on your site, it may be interfering with the web page you are trying to load into your browser. Please double check the .htaccess configuration. Any syntax errors will cause a 500 Internal Server Error message to be displayed instead of your website.
To confirm whether a misconfiguration .htaccess is the cause of the 500 Internal Server error, either remove or rename the .htaccess file temporarily and then try to reload the page
PHP CODING TIMING OUT
If your PHP script makes external network connections, the connections may time out. If too many connections are attempted and time out, this will cause a «500 Internal Server Error.» To prevent these time outs and errors, you’ll want to make sure that PHP scripts be coded with some timeout rules. Typically, however, catching a timeout error when connecting to a database or externally to remote resources (example: RSS feeds) are difficult. They, in effect, freeze the script from continuing to run.
Removing any external connections can increase both the performance of your website and decrease the chances of you receiving a «500 Internal Server Error.»
Одна из наиболее распространенных ошибок, возникающих при просмотре веб-страниц, — это «500 Internal Server Error». Это сообщение указывает на то, что на веб-сервере возникли технические проблемы.
В этой статье объясняется, что означает ошибка 500, почему вы получаете код HTTP 500 и как устранить эти ошибки.
Что такое ошибка HTTP 500
Каждый раз, когда вы открываете веб-страницу, ваш браузер отправляет запрос на сервер, на котором размещен сайт, который возвращает запрошенные данные и код ответа. Коды состояния HTTP-ответа указывают, был ли запрос успешным или нет.
Ответы делятся на пять классов. Коды в диапазоне от 500 до 599 указывают на ошибку сервера.
Код состояния HTTP 500 — это общий ответ об ошибке, который возвращается сервером, когда другой код ошибки не подходит. Это может быть вызвано рядом проблем, которые не позволяют серверу выполнить запрос.
Если страница, которую вы посещаете, выдает ошибку 500, вы ничего не можете сделать, поскольку ошибка не вызвана вашим браузером или подключением к Интернету. Несмотря на то, что ошибка возникает на стороне сервера, вы можете попробовать некоторые из следующих вариантов:
- Перезагрузите браузер или попробуйте использовать другой. Шансы, что страница загрузится при обновлении браузера, невелики, но все же стоит попробовать.
- Попробуйте очистить кеш браузера. Если страница, на которой отображается ошибка 500, кэшируется, после очистки кеша браузер запросит новую версию страницы.
- Вернуться позже. Тем временем веб-мастер может устранить проблему с сервером.
- Свяжитесь с владельцами веб-сайтов. Последний оставшийся вариант — связаться с лицом, ответственным за обслуживание веб-сайта.
Устранение неполадок 500 Ошибка
Ошибка 500 Internal Server Error может быть вызвана рядом различных причин. Вот самые распространенные:
- Проблема с разрешением. Когда веб-сервер не имеет разрешений на доступ к файлам сайта, он может выдать ошибку HTTP 500. Решением этой проблемы является рекурсивное изменение разрешений для файла веб-сайта .
- Ошибка синтаксиса
.htaccess
. Если вы используете Apache в качестве веб-сервера, то, скорее всего, у вас есть файл.htaccess
в корневом каталоге вашего сайта. Неверный синтаксис или несуществующая директива модуля может привести к ошибке 500. - Проблема, связанная с базой данных. Ошибка HTTP 500 также может быть вызвана неверной информацией о сервере базы данных или поврежденной базой данных.
- Проблемы с плагинами и темами. Если вы используете WordPress или аналогичную CMS, ошибка 500 может появиться после обновления или изменения плагина / темы.
- Проблемы с сервером. Поврежденная файловая система или исчерпанная память могут привести к ошибке 500.
- Модули Node.js. Если у вас есть сайт на основе Node.js, обновление модулей может вызвать внутреннюю ошибку сервера 500.
- Взломанный сайт. Довольно часто вредоносный код, внедряемый на ваш сайт, приводит к ошибке 500.
- Несовместимый модуль. Загрузка несовместимого модуля PHP или Apache вызывает ошибку 500.
- Тайм-аут внешнего ресурса. Если сервер взаимодействует с внешней службой и если эти службы недоступны, сервер отобразит сообщение об ошибке 500.
Лучший способ определить, почему произошла ошибка 500, — это проверить файлы журнала сервера. Расположение файлов журнала зависит от вашего дистрибутива Linux и веб-сервера. Наиболее распространенные места для Apache и Nginx следующие:
/var/log/apache2/error.log
/var/log/httpd/error_log
/var/log/nginx/error_log
Если ваше приложение построено на Node.js, проверьте журналы Node.js.
Обычно журнал сервера содержит подробную информацию об ошибке, которая поможет вам определить и исправить ошибку.
Выводы
Ошибка 500 Internal Server Error — это общий код состояния HTTP, означающий, что что-то пошло не так с веб-сервером, на котором размещен сайт, который вы посещаете.
Если у вас есть какие-либо вопросы или отзывы, не стесняйтесь оставлять комментарии.
At some point in time, you must have encountered a 500 Internal Server Error while trying to access a particular website. As a visitor, you may ignore it, but as a website administrator, you cannot afford to ignore it and get rid of it as soon as possible.
Not only the website frontend but also the WordPress administrator dashboard might not be available to access. In this article, we will walk you through some of the reasons why this error occurs, how to avoid it, and why it is important to invest in a reliable web hosting server to avoid this error and improve website uptime.
The frequent occurrence of 500 internal server errors is bad for the reputation of your business and will lead to visitors losing trust in your brand. Besides the reputation, it will also hurt your search engine rankings. Hence it is advised to avoid this error, and deeply understand what it is all about and how to troubleshoot.
Sometimes it could be due to the problem in website configuration, while sometimes it has something to do with issues at the server, which might be beyond your control.
What is a 500 Internal Server Error?
In one of our previous articles about HTTP Status codes, we have covered in detail the type of errors website users might encounter. The 3-digit error status code that starts with ‘5’ and looks like 5XX indicates that there is no problem with the request made by the user agent.
But due to some other reasons, the server is not able to process the request due to incorrect configuration of the website or due to some issue encountered within the server.
While 500 specifically indicates that the webserver is facing some kind of Internal issue due to which the request made by the user agent could not be processed at that moment. Sometimes this kind of error is momentary, which lasts for a few minutes and sometimes just a few seconds.
But if the problem persists, chances are that there is a problem with the website. Also, it is found that often the issue arises due to incorrect configuration of the website, which you can fix at your end.
But if this is very frequent you should discuss the problem with the web server tech support team to help you troubleshoot the issue. Some other popular 5XX error codes are 502 Bad Gateway error, 504 Gateway timeout error
For a more specific kind of issue, you need to look into the specific error code using tools like MS IIS. Some of the most commonly occurring codes are as shown below:
Code List of 500 Internal Server Errors
Code | Explanation |
500.11 | The application crashes down on the webserver when a request is made by a user agent. |
500.12 | The application is under the restart process on the webserver. |
500.13 | The web server is too busy with other requests. In other words, it is overloaded with a large number of requests, which is more than its capacity. |
500.14 | Invalid application configuration on the server. The WordPress website installation is incorrect or corrupt. |
500.15 | Direct requests for GLOBAL.ASA is not allowed. |
500.16 | UNC authorization credentials are incorrect. |
500.17 | URL authorization store cannot be found. |
500.18 | URL authorization store cannot be opened. |
500.19 | Data for this file is configured improperly in the Metabase. |
500.2 | URL authorization scope cannot be found. |
500.21 | Module not recognized. |
500.5 | A rewrite error occurred during RQ_BEGIN_REQUEST notification handling. A configuration or inbound rule execution error occurred. |
What are the reasons that cause 500 Internal Server Error in WordPress?
If there is a 500 internal server error on your WordPress website the users will not be able to access any of its pages, which indicates that there could be a problem at the root directory. Here are some of the most common issues due to which your WordPress website has an HTTP 500 Internal Server Error.
- corrupt .htaccess file
- Exceeding PHP Memory Limit
- Faulty Plugin or theme Issue
- Corrupted Core Files
- Check File Permissions
- Unsupported PHP Version
- Incorrect DNS entries
- Problem with Server itself
- Inode Limitation Reached
#1 – Corrupt .htaccess file
One of the most common causes of WordPress 500 error is a corrupted .htaccess file (found in the root directory) that might arise due to a plugin update, theme update, etc., or during the migration from one server to another. To fix this error you can replace the current .htaccess file with another one.
Sometimes you might not be able to see the .htaccess file, in such cases check the hidden files in the root directory as well. Also, make sure that the file is correctly named.
#2 – Exceeding PHP Memory Limit
This could happen due to some plugin or theme consuming a lot of processing memory, or if you are using too many plugins. If your WordPress website is consuming a lot of memory to process a request you might run out of memory limit.
You can increase the memory limit to troubleshoot this problem. This could be done by making some modifications to the wp-config file or php.ini file.
Add this code to the wp-config file:
<?php
define('WP_MEMORY_LIMIT','64M');
You can increase the memory limit by changing 64M to 128M, 256M, and so on.
Alternatively, you can increase the memory limit through php.ini. Edit your php.ini, find out the line of code that defines the memory limit which will look like this:
memory_limit = 32M ;
You can increase it to 64M, 128M, 256M, and so on.
Another related issue is with Maximum Execution Time. If a request made by the user agent takes more than the time limit set for the website process request. You can increase the max execution time limit either through the wp-config file, .htaccess file, or php.ini file.
To define the Max Execution Time using wp-config, add the following code or if the code already exists increase its value:
set_time_limit(300);
To increase the time limit using the .htaccess file, add or edit the following code:
php_value max_execution_time 300
You can edit php.ini as well to increase the execution time using this code:
max_execution_time = 300
#3 – Faulty Plugin or theme Issue
If you have recently installed or updated a plugin you might need to investigate if that is causing an issue. If you can access the admin dashboard, you can deactivate all the plugins at once, and then refresh the website to check if it works now.
If it works reactivate the plugins one after the other and check after activating each of the plugins. That way you will be able to identify which plugin is causing the issue. If after deactivating the plugins the website is still not working then the issue is obviously not due to any of the plugins.
If you are not able to access the admin backend you can rename the directory of each of the plugins, and while doing so you can check the website after renaming each of these and see if the problem resolves. Also, it is recommended to keep all the plugins updated.
Try updating or switching the theme of your WordPress website and see if the internal server error is gone. Sometimes outdated or corrupt scripts and codes within the theme files can lead to an internal server error. If you have encountered this error after a theme update, report this to the theme developer, and restore it to a previous version.
That is why it is recommended to take regular backups of your website, especially before making themes, plugins, or core installation updates. Some hosting providers also provide you with Error logs that might help you further identify the cause of the error.
Hosting providers like WPOven provide you with a console within your hosting console to update the plugins, themes, core files, and many other management tools for better performance and control over your website along with regular backup and restore options.
#4 – Corrupted Core Files
You can upload the updated files through an FTP server to troubleshoot the internal server error on your WordPress website. You can upload the updated files from WordPress.com and upload them to the server using FTP software like FileZilla etc.
#5 – Check File Permissions
To make the WordPress website work perfectly fine, it is essential to have all the directory and file permissions correctly configured. The recommended file permission settings are as follows:
- 755 for all folders and sub-folders.
- 644 for all files.
Incorrect permission settings will lead to the blocking of some plugins, themes, and scripts to work.
At WPOven you can use the “Fix Permissions” tool for fixing file permissions in Sites->Tools in the dashboard.
#6 – Unsupported PHP Version
There are outdated PHP versions that are not supported by the latest WordPress version anymore. One of the latest versions 7.0, 7.1, 7.2, 7.3, and 7.4 are highly recommended. You can refer to our article on PHP Versions as well for more details.
Also, you can find the latest PHP 8 version here. WPOVen – Managed WordPress Hosting Comes with the latest PHP Updates.
#7 Incorrect DNS entries
If your DNS is pointing to a server other than your hosting server, the visitors will not be able to access it. Make sure that the DNS entries are accurate.
#8 – Problem with Server itself
If none of them work you should immediately contact the tech support team of your web hosting provider to troubleshoot. There might be a problem with either the server hardware or the software. If there are frequent outage reports at the server end you should consider switching to another company.
#9 – Inode Limitation Reached
Each hosting account has a certain limitation on the number of inodes it can support, meaning the total number of files and directories you can create.
As your site keeps on growing, it will use more inodes. That is why you need to be more mindful about your inode usage.
So one of the ways you can resolve this issue is by starting to delete all the unnecessary files on your server. Here is an in-depth tutorial that will walk you through the entire process of deleting your inodes.
Check out our article on WordPress Security here
Tips to avoid 500 Internal Server Error and Quick Troubleshoot
- First and foremost, keep all the plugins, themes, and WordPress Core updated. The outdated versions tend to create more problems and are more prone to security threats like malware and hacking.
- Always take regular backups of your WordPress website files and database. Use a good plugin that takes regular backup and can easily restore the website to the desired version.
- Turn on ‘Debugging’. It is a small trick that will help you easily debug the website, by giving you vital information about the cause of the issue. It can be enabled by adding the following line of code in your wp-config file: “define( “WP_DEBUG”, true );”
- Increase your PHP Memory Limit (as explained above).
- Use a highly reliable server.
- Use security plugins to scan and audit your website regularly.
- Use reliable and trusted plugins and themes only, that provide good support.
Some of the top web server hosting companies like WPOven have a system in place to keep a close watch on the hosted WordPress websites and send out a notification to the website administrator. There are some free web-based website monitoring tools like UptimeRobot, that also send notifications in case the website is not working for any reason.
Step 1: Reload the page, sometimes there is a momentary issue with the server, so a simple reload of the page will get you to the page.
Step 2: Clear Browser Cache: Using Hard Refresh (Ctrl + F5) you can clear the cache, moreover you can go to browser history and clear the browser cache.
Step 3: Try accessing the wp-admin backend of your WordPress installation.
Step 4: If you can access the admin dashboard, deactivate all the plugins to see if it resolves the problem. If it does, start reactivating the plugins one by one to identify the one creating the problem. You have to get rid of that plugin. Before doing this make sure that all the plugins are updated to the latest version.
Step 5: If you are unable to resolve the issue, switch the theme to the default one, if it resolves the issue you will have to update the theme or change the theme. Probably some of the theme files could get corrupted, hence you can re-upload the files.
Step 6: If the problem persists, check the .htaccess file, file permissions, as well as (as explained above),
Step 7: You can also check out your error logs and find out the possible causes that trigger 500 internal server errors. All you need to do is log in to the FTP client and then navigate to the Error log Directory and either download it or directly open it in an editor.
This will help you to narrow down the issue so that you easily figure out the exact problem and you can immediately fix it. You can also read our complete guide on How to access and set up WordPress error logs?
Step 8: It is also highly possible that the 500 internal server error can generate due to corrupt WordPress core files, especially if you are running an old website. To fix this, the easiest thing you can do is to completely replace the old WordPress core files with the new ones without affecting your WordPress theme and plugin.
To reinstall WordPress core files, you can refer to our detailed and comprehensive post on How to reinstall WordPress using the 4 best methods?
Step 9: If the problem persists, immediately contact the tech support team to help you resolve the issue and make your website live.
Where can you see a 500 Internal Server Error?
- HTTP 500 Error on a WordPress Website:
- 500 Error on Linux:
- 500 internal server error in NGINX
HTTP 500 internal server Error on a WordPress Website:
If your website has encountered an internal server error, you will not be able to access the website. In extreme cases, you might not be able to access even the wp-admin backend.
Typically, your browser will show any of the following messages:
- “500 Internal Server Error”
- “HTTP 500”
- “Internal Server Error”
- “HTTP 500 – Internal Server Error”
- “500 Error”
- “HTTP Error 500”
- “500 – Internal Server Error”
- “500 Internal Server Error. Sorry, something went wrong.”
- “500. That’s an error. There was an error. Please try again later. That’s all we know.”
- “The website cannot display the page – HTTP 500.”
- “Is currently unable to handle this request. HTTP ERROR 500.”
500 internal server Error on Linux:
If your website visitors are getting the 500 HTML error status you can troubleshoot it using Linux as well, especially if the error arises due to any of the CGI or PERL scripts.
Also, the error can be due to the non-compatible versions of PHP and Apache. In such a case you need to upgrade PHP or recompile Apache. In Apache you can go through the error logs in the following locations:
/usr/local/apache/logs/error_log
/usr/local/apache/logs/suphp_log
You can use Linux commands to fix the errors, for example, to change the file and folder permissions you have to use the following commands:
cd public_html
find . -type d -exec chmod 755 {} ;
find . -type f -exec chmod 644 {} ;
500 Server Error on some Popular Websites:
Though there are lesser instances of 500 internal server errors on the world’s most visited website, even then they have encountered the error at some point in time. Some websites have very creatively designed error pages as well. Some of the examples are shown below:
- FitBit.com:
- Amazon
- Disney
- GitHub
Some of the leading Content Delivery Network providers like Amazon’s AWS offer to create a custom page when there is a 500 internal server error.
How to Fix 500 Internal Server Error in NGINX?
When there is an issue that happens on the server side, due to which NGINX is unable to return a proper response, it starts showing a 500 internal server error. The issue can happen due to multiple reasons some of the most common are, limited file permissions and errors in the script.
However, you can easily fix this error by following these simple methods:
- Force refresh or restart your webpage.
- Check out your Error logs.
- Check out the Scripts.
- Check whether adequate permission is granted to folders and files.
- Check all your redirections.
How does 500 Internal Server Error Effects your Search Engine Ranking?
Non-availability of websites, or in other terms longer and frequent downtime of the website can negatively impact your search engine rankings. Google always strives to provide a good user experience to the visitors, and hence if many visitors encounter the problem at different points in time it will downgrade the ranking of the website for sure.
Hence it is important to take these errors seriously and keep monitoring the websites. Using Google Analytics as well as Search Console you can see how many visitors faced the error. Besides the user experience, Google crawler also crawls the website regularly, and while crawling it found that the website is not available consistently which will negatively affect the rankings.
Conclusion
The seriousness of the 500 Internal Server Error depends on how frequently the error occurs, and the cause of the error. If the error lies with the website files or configuration then you need to fix it or get professional help.
But if errors frequently occur due to some problem with the server’s hardware or software then you need to immediately migrate to a more reliable and trusted hosting company.
Overwhelmed with too many server issues!! Choose a more reliable server instead. Host your website on WPOven now and save your time, money, and resources. Give your website a mammoth growth with WPOven’s Fastest, and Fully managed Dedicated Servers.
- Fastest Private Servers
- Fully WordPress optimized Servers
- Upto 100% server uptime
- Server stack
- Hardened Servers with high-end security
- 24X7 WordPress Expert support
- Datacentres around the world, etc.
You can have all these features and much more. Plans start at $16.61 per month with unlimited Free migrations, unlimited staging, and a 14-day risk-free guarantee. Check out our plans or Contact our support team that assists you to choose the right plan.
General FAQ
What does 500 internal server error mean?
The Hypertext Transfer Protocol (HTTP) 500 Internal Server Error response code represents that the server is unable to fulfill a particular request that was made by a user at the front end of the website.
How do I fix internal server error?
The best and quickest ways to fix the internal server errors are
- Try reloading your web pages. Do it with F2 or Ctrl+F5
- Clear the cache of your browsers.
- Delete all browser cookies.
- You can also contact the website admin to let them know
What causes internal server error?
500 Internal Server errors are caused due to server errors where the server may not be able to fulfill any particular request at that time. It may also cause due to some policy issues with your APIs.