[Solved] HTTP Error 503. The service is unavailable

HTTP Error 503. The service is unavailable

Web servers such as LiteSpeed and Apache use various codes to tell browsers about responses. For example, if the web server replies back with HTTP code 200, it means that everything is fine and the response generation was successful. There are many other response codes, but today we will discuss HTTP Error 503, and when this usually happens you get following error on your browser: HTTP Error 503. The service is unavailable.


If you are not the administrator of the site, there is nothing much you can do as mostly this error indicates that there is something wrong on the server side. You can either refresh the page, visit later or better notify an administrator of the site. However, if you are the administrator of the site, you can do much to figure out what is wrong and there are various reasons and ways to fix this error. There are multiple web servers, each may give you a slightly different error message, such as:


  1. 503 Error
  2. Http/1.1 Service Unavailable
  3. 503 Service Temporarily Available
  4. 503 Service Unavailable
  5. HTTP Error 503
  6. Service Unavailable – DNS Failure
  7. Error 503 Service Unavailable


Usually, the main thing to look for is error code which is HTTP error code 503. Today we will see how we can discuss various reasons and respective ways to fix the issue.


Server Side Issue


Before deep diving into various reasons as to why this could happen, I would again like to mention that this is a server side issue. All errors in the 5xx range are considered errors on the server side including 503 Service Unavailable Error. However do keep in mind that 503 error means the server was able to process your web request and it was functioning properly but it chooses to return 503 error code because due to some problem/issue server is not able to process this request the way it should have.


Refresh the page


Some times you will get the following error


503 Service Unavailable – The server is temporarily busy, try again later!




It may really be a temporary error as the error message says, so wait some time and refresh the page. This can happen to high traffic sites, where enough resources are not available to handle the request. On the user end, be careful if you are seeing this error on the payment related pages, and make sure you won’t get charged twice.

Using our Apache as Backend Feature


If you are our customer and using our Apache as Backend feature, there is a chance that Apache is down. In this case frontend server which is OpenLiteSpeed, will give you 503 error, as it is failed to connect to Apache. See if Apache is running


systemctl status httpd


If Apache service is not running, you can start with


systemctl start httpd


And see if your issue is resolved.


PHP FPM is down


If you get something like (Assuming you are using our Apache as backend feature or your stack includes PHP-FPM)


Service Unavailable

The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.


This means your PHP-FPM service is down. You can start php-fpm using


systemctl start php-fpm


In case you are our customer, there are multiple PHP-FPMs are available for different PHP versions and their respective commands are:


systemctl start php54-php-fpm

systemctl start php55-php-fpm

systemctl start php56-php-fpm

systemctl start php70-php-fpm

systemctl start php71-php-fpm

systemctl start php72-php-fpm

systemctl start php73-php-fpm


Check various log files


If your issues are still not resolved, you can start to check various log files. In the case of CyberPanel and LiteSpeed (OpenLiteSpeed), log files to check are:





In the case of Apache




You can do an efficient search of log files using the grep command such as:


cat log_file_path | grep error

cat log_file_path | grep notice


This command will make sure that you only get the most relevant information, otherwise, you may also get info level messages in your log files and they are not relevant in this case.

503 Errors due to PHP Malfunction


Most of the times 503 errors can come due to a problem in your PHP code, or either PHP-FPM/LSPHP are not able to produce response thus server started giving you 503 error. It is always recommended to first create a phpinfo page and see if your PHP side is working fine. If you can see the phpinfo page, you can move forward to further debug the cause, otherwise, make sure LSPHP is working fine and external application is created properly or PHP-FPM is up and running.


Disable PHP OPCode Caching (xCache, ACP or eAccelerator)


On a default install of CyberPanel (OpenLiteSpeed or LiteSpeed Enterprise), OPCode caching is enabled. Sometimes different sorts of opcode caching can have compatibility issues with LSPHP (PHP). So if you are getting HTTP Error 503 Error better try to disable opcode caching. On CyberPanel you first need to find out which PHP version is used by your site. To find out your PHP version on CyberPanel run the following command


cat /usr/local/lsws/conf/vhosts/ | grep php


For example, the PHP version of your site is 7.2. Go to the configurations directory of PHP 7.2 and disable opcode caching.


cd /usr/local/lsws/lsphp72/etc/php.d

mv 10-opcache.ini 10-opcache.ini.bak

systemctl restart lsws


/usr/local/lsws/bin/lswsctrl restart


This will disable OPCode caching. If you are not on CyberPanel, you need to find the php.ini file for your PHP and disable OPCode caching. Usually, php.ini location is disclosed in phpinfo page. If your issue is still not resolved, you can move on to the next step.

No space left on /tmp


Some web application use /tmp directory to store temporary files (session data etc). If /tmp is full you can get HTTP Error 503 Error. Use the following commands to inspect /tmp directory space


df -h

df -i



PHP memory_limit reached


memory_limit is a php directive that specifies how much memory a PHP script is allowed to allocate. Sometimes your application might be exceeding this limit, thus failed to produce response for the web server resulting in HTTP Error 503 Error. As explained above, first find out the PHP version used by your site. Then you can directly increase memory_limit from CyberPanel interface.


Login to your CyberPanel Dashboard then from left sidebar PHP -> Edit PHP Configs



  1. Select PHP version to change the value of memory_limit directive.
  2. Set the new value of the directive.


Finally, scroll down and click Save Changes.


max_execution_time reached


max_execution_time is similar to memory_limit. So if your PHP script exits early without producing response again you will get the same error. You can follow the same procedure as described above to fix max_execution_time as well. Make sure to set it to a high enough value so that your script is properly executed.



We’ve pretty much discussed all the possible causes of “HTTP Error 503. The service is unavailable”. However we recommend moving your sites to CyberPanel, because CyberPanel use LiteSpeed servers. Which means in low cost VPS you can host more sites, and using LSCache WordPress plugin you can avoid many such errors including HTTP Error 503. Because if your pages are cached, PHP engine is not used, thus giving other applications more resources to run. So in a low cost server you can run multiple sites at super fast speed and avoid such errors. You can learn in our OpenLiteSpeed vs NGINX comparision post as to why you would use CyberPanel and OpenLiteSpeed.


You can also get our managed vps and let us do this for you. We offer 3 days trial (no credit card required, plus free migration and fully managed support)

InnoDB: Cannot allocate memory for the buffer pool [Solved]

Recently we received a ticket where the client pointed out that his MySQL server was not starting. Upon investigation, we found out that the client used our MySQL Optimization tool to optimize and enhance MySQL performance. Our MySQL optimization tool set value of innodb-buffer-pool-size size depending upon the available ram on the server. The current formula set its value to 35% of the server ram. Which is fine for most cases, but in this case it was not good, because there were some other processes in the client server taking more ram, so there was not enough ram available to allocate for innodb-buffer-pool-size thus MySQL reports  InnoDB: Cannot allocate memory for the buffer pool as error in MySQL log file.


Depending upon the MySQL version you might also receive innodb fatal error cannot allocate memory for the buffer pool as an error, which is the same error with a different description.


If doing this is too much for you, you can sign up with us and let our experts do this for you. We offer 3 days free trial no credit card required start free with our managed vps now. We also help our customers with MySQL optimizations.

What is InnoDB Buffer Pool (innodb_buffer_pool_size) and why it is important?


InnoDB Buffer is the space in memory used by MySQL to hold many of its InnoDB data structures. Such as caches, buffers, indexes, and even row data. And then innodb_buffer_pool_size is the MySQL directive that controls its value. This is one of the most significant directive in MySQL perspective and should be set with care if you want to improve your MySQL performance.


In this tutorial we will see how we can calculate and set optimal value for innodb_buffer_pool_size depending on the available memory on your system and then we will discuss on how to solve InnoDB: Cannot allocate memory for the buffer pool error in case you run into it at a later point in time.

70% – 80% of the Available Ram


Normally if your server is only dedicated for MySQL it is recommended to set innodb_buffer_pool_size value to 70-80% of the available ram. So for example, if your server has 8GB of ram, you can calculate the value of innodb_buffer_pool_size using this formula


8 * 0.80 = 6.4GB


But in case if your server has a very large amount of ram such as 256GB, then you can further enhance it to 90% as well. Because if your server is only being used for MySQL, the rest of the ram will go in waste, so you can increase or decrease this value depending upon the available ram or your needs.


If doing this is too much for you, you can sign up with us and let our experts do this for you. We offer 3 days free trial no credit card required start free with our managed vps now. We also help our customers with MySQL optimizations.

Optimal value with CyberPanel


When you are using CyberPanel then 70-80% ram cannot be allocated for innodb_buffer_pool_size size, because there are many other things running and there must be some room for them to breath. Otherwise, if you set a large value for innodb_buffer_pool_size you will start receiving InnoDB: Cannot allocate memory for the buffer pool or innodb fatal error cannot allocate memory for the buffer pool as an error. Which means there is not enough ram available and MySQL cannot start now. Which is why our optimization tool set it to 35% of the available ram.


But sometimes 35% is not good as well. For example, you have lots of websites and they are continuously forking PHP processes and you are also using FTP and DNS server. Then you either need to further go down with the value of innodb_buffer_pool_size.

Fixing the InnoDB: Cannot allocate memory for the buffer pool error


Now let see how we can fix this error, let say you have used or MySQL Optimization tool, and now MySQL is not starting. First, make sure that this is the reason your MySQL is not starting. You can open the MySQL log file located at /var/lib/mysql/mysqld.log. This location is set by our optimization tool, if you are not using our tool, you can find MySQL log file depending upon your configuration, and you must see the following lines somewhere in the log file


2019-06-11 10:52:09 140525444196608 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2019-06-11 10:52:09 140525444196608 [Note] InnoDB: The InnoDB memory heap is disabled
2019-06-11 10:52:09 140525444196608 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-06-11 10:52:09 140525444196608 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2019-06-11 10:52:09 140525444196608 [Note] InnoDB: Compressed tables use zlib 1.2.7
2019-06-11 10:52:09 140525444196608 [Note] InnoDB: Using Linux native AIO
2019-06-11 10:52:09 140525444196608 [Note] InnoDB: Using SSE crc32 instructions
2019-06-11 10:52:09 140525444196608 [Note] InnoDB: Initializing buffer pool, size = 358.0M
InnoDB: mmap(393183232 bytes) failed; errno 12
2019-06-11 10:52:09 140525444196608 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
2019-06-11 10:52:09 140525444196608 [ERROR] Plugin ‘InnoDB’ init function returned error.
2019-06-11 10:52:09 140525444196608 [ERROR] Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed.


Pay close attention to the bold lines, we are now sure that MySQL failed at InnoDB: Initializing buffer pool. Now open /etc/my.cnf and find innodb-buffer-pool-size = xxxM. Now set the value of this directive to something lower such as 50MB just for test and restart MySQL using systemctl restart mysql. However, you can play with various values and make sure you get the optimal value for your configuration.


If doing this is too much for you, you can sign up with us and let our experts do this for you. We offer 3 days free trial no credit card required start free with our managed vps now. We also help our customers with MySQL optimizations.


WhatsApp chat