LiteSpeed 503 service unavailable error – Here’s the quick fix

LiteSpeed 503 service unavailable error – Here’s the quick fix

Table of Contents

Websites show up different error codes depending on the underlying problem.

Likewise, LiteSpeed shows 503 service unavailable error when it is unable to handle the HTTP request. This happens due to a temporary overloading or maintenance of the server.

And, finding the exact reason for overloading of LiteSpeed web server can be tricky.

As part of our Technical Support Services, we see 503 errors from many panic customers.

Today, we’ll see how our Support Engineers find out the reason for LiteSpeed 503 service unavailable error and fix it.

What causes LiteSpeed 503 service unavailable error?

Usually, the 503 service unavailable error occurs when there is a problem with the PHP running on the server. It can crash and may not be able to serve the web page. As a result, the web page shows the error.

“503 service unavailable, The server is temporarily busy, try again later”.

Just as the error says, the error is temporary and can get automatically fixed. But, when the error happens too often, we cannot wait for this automatic fix and need a permanent solution.

Now, let’s have a look at the various reasons that would cause 503 errors in LiteSpeed web server.

 

1. Memory constraints

In LiteSpeed, there is a hard limit and soft limit set for LiteSpeed PHP process (lsphp). When any of the php scripts tries to use more memory than the allowed limit, it will end up in 503 service unavailable error.

Again, this error can happen on reaching PHP memory_limit on the server too. This PHP internal memory limit is normally controlled by the php.ini file. Whenever, process exceeds the limit, it will result in the error:

Fatal error: Allowed memory size of 288435456 bytes exhausted (tried to allocate 932351 bytes) in /home/myweb/public_html/myapp/login.php on line 208 2018-03-13 11:31:56.023 [STDERR]

 

2. Bad LiteSpeed configuration

Similarly, often bad values in LiteSpeed configuration can also lead to 503 errors. This include LiteSpeed connection time out, Keep-alive time out, etc.

These values can stop a process and produce service unavailable error.

 

3. Using multiple cache modules

Usually, Cache modules can speed up the website. But, when you are using multiple cache modules, it can create conflict and end up in 503 service unavailable error.

For example, when you already have cache module eaccelerator, running xCache will create problems. From our experience in managing LiteSpeed servers, our Support Engineers often see problems happening due to wrong versions of cache module too.

 

4. CSF/LFD killing php

Again, firewall software like CSF/LFD on the server can kill the running PHP process on the server. This will also result in 503 service unavailable error in LiteSpeed. Here, the firewall constantly monitors the PHP process and take necessary action as per the configuration set.

 

5. Disk full

Last, but not the least, 503 service unavailable error can occur when the disk space usage on the server is full. This will affect the writing of temporary files to /tmp directory and result in error.

 

How to fix 503 service unavailable error ?

So far, we saw the various reasons that can end up in 503 service unavailable error in LiteSpeed.

Luckily, LiteSpeed itself has a mechanism to auto correct the 503 errors. We always enable this option from LiteSpeed Admin console.

However, if there are frequent 503 service unavailable errors, it needs a permanent fix. Now, let’s have a look on how our Dedicated Engineers fix them permanently with step by step approach.

 

1. Tracking the logs

Just like any other web server error, the first step in fixing LiteSpeed 503 site unavailable error is checking the LiteSpeed server logs. For a plain LiteSpeed installation, our Support Engineers check the logs at /usr/local/lsws/logs/error.log. But, in a cPanel server, we check it at /usr/local/apache/logs/error_log.

The log entries give a clue on the actual reason for the 503 error. The sample entries would look like:

2018-06-12 10:00:45.060 [NOTICE] [XX.XX.XXX.XX:40678] request already in process for 321 seconds, fail with 503
2018-06-12 10:00:45.060 [NOTICE] [XX.XX.XXX.XX:40678] oops! 503 Service Unavailable

Here, we search the logs with the domain’s user name. Thus, we get the details about the specific website.

 

2. Setting memory limits

Further, the fix for LiteSpeed 503 service unavailable involves setting proper memory limits. This may have to be done in LiteSpeed or in PHP configuration depending on the scenario.

The exact memory error would look like :

Fatal error: Allowed memory size of 288435456 bytes exhausted (tried to allocate 932351 bytes) in /home/sarah/public_html/myapp/begin.php on line 128
2018-10-02 10:31:43.023 [STDERR]

This means that the begin.php script was using more memory that the limit set in LiteSpeed. That’s why, to fix the error, we increased the memory limit values from LSWS WebAdmin Console >> Server >> External App >> lsphpx

Again, if PHP memory limits cause problems, we fix it by editing the php.ini file of the domain and increase the values.

Recently, one of our customers reported LiteSpeed 503 service unavailable error in his CloudLinux server. Here, the  user process was exceeding the CloudLinux limits allotted to that user. To fix, our Dedicated Engineers had to redefine the CloudLinux user limits.

 

3. Removing duplicate Cache module

Multiple cache modules always create problems in LiteSpeed. That’s why, we ensure that there is only one caching module on the server. For instance, if the server already has Opcache cache module, we disable the eaccelerator module.

 

4. Tweaking Firewall module

In a recent support request, the reason for 503 error was LFD module affecting the PHP process. Here, LFD was automatically killing processes with higher limits. The firewall logs at /var/log/lfd.log showed up as:

May 16 22:53:58 xxx lfd[2014840]: Excessive Processes  User:abc Kill:0 Process Count:13
May 16 22:55:58 xxx lfd[2018465]: User Processing  PID:1976845 Kill:0 User:abc Time:1822 EXE:/opt/cpanel/ea-php56/root/usr/bin/lsphp.cagefs CMD:lsphp

To fix the error, our Dedicated Support Engineers increased the process timeout settings in LFD configuration and increased the user process limits. Again, we excluded the php process /opt/cpanel/ea-php56/root/usr/bin/lsphp.cagefs in the csf ignore configuration file at /etc/csf/csf.pignore. As a result, even when the process lsphp.cagefs exceeds the limit, no further action will be taken on the process.

 

5. Removing conflicting PHP modules

From our experience in maintaining LiteSpeed web server, we often see that PHP modules like Ioncube, Suhosin or Zendguard can cause 503 errors due to incompatibility issues.

Here, to fix the error, we disable the module by commenting out the entry from the php.ini file. Then, our Support Engineers restart the LiteSpeed server and website loads properly.

 

6. Ensuring enough free disk space

As disk space problems can also contribute to service unavailable errors, we always ensure that there is enough free space in server partitions. Additionally, our Dedicated Engineers see that the user disk quota is not full too.

[Are you getting 503 service unavailable error in LiteSpeed? We can fix it right away.]

 

Conclusion

In a nutshell, LiteSpeed 503 service unavailable error happens mainly due to user process exceeding LiteSpeed memory limits, PHP limits, disk full issues and more. Today, we discussed the various reasons for the 503 error and how our Dedicated Engineers fix them.

Leave a Comment

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

Social Share

Facebook
Twitter
LinkedIn
Telegram

Cheapest Web Hosting

Fasters Web Hosting Promo
Scroll to Top

Launch your Website at RS599

Create a professional website yourself with our domain hosting combo. Get Extra benefits at this Year end Sale with 10% OFF and Enjoy Amazing Deels on Shared Hosting!

Starting at Only RS599/Year

Year End Sale

Hours
Minutes
Seconds

Use Code STARTBIZ at Checkout.

Create an earning opportunity with A Web Hosting Business

Become reseller and start reselling domains, web hosting, ssl certificates and More.

45% OFF

Starting at RS399/Month

Hours
Minutes
Seconds

Use coupon: at the checkout.