Did you ran into an error such as “LiteSpeed out of memory PHP” or “Fatal error: Out of memory”, in this tutorial we will discuss how to fix this problem.
A strong, high-performance web server program that can manage a lot of traffic is called LiteSpeed Web Server. But if LiteSpeed PHP attempts to utilize too much RAM, it can get an out-of-memory problem. If the LiteSpeed out-of-memory PHP problem is something you are also experiencing, you are not alone. The identical problem has been reported by several users. The good news is that there are a few efficient fixes for this mistake.
What is LiteSpeed?
The top high-performance, high-scalability web server from LiteSpeed Technologies is called LiteSpeed Web Server. Without altering any other applications or operating system specifics, it may be used to replace an existing Apache server. The best part is that it may be fitted without causing any damage. As a result, LiteSpeed Web Server may easily take the place of a significant bottleneck in your current web hosting infrastructure.
LiteSpeed Web Server can assist you in overcoming the difficulties of implementing a successful web hosting infrastructure thanks to its extensive variety of capabilities and simple-to-use web management dashboard.
Advantages of LiteSpeed?
The performance of LiteSpeed Web Server is higher in terms of both speed and scalability. LiteSpeed serves PHP websites more quickly than Apache. Given that it quickly improves PHP’s performance and security, it makes an excellent hosting platform for websites powered by WordPress, Joomla, and Drupal.
Compatibility with Apache
The widely used Apache web server and its components, including mod rewrite, .htaccess, and mod security, are compatible with LiteSpeed Web Server. Even the Apache configuration files may be loaded by LiteSpeed Web Server, enabling it to function as an exact substitute for Apache.
Get exclusive access to all things tech-savvy, and be the first to receive
the latest updates directly in your inbox.
Additionally, it works with popular hosting control panels including CyberPanel, cPanel, Plesk, and DirectAdmin.
Efficiency and Scalability
Through its distinctive event-driven design, LiteSpeed Online Server improves the speed & scalability of web hosting systems. It can handle thousands of clients concurrently while using the least amount of CPU and memory on the server. The LiteSpeed Web Server’s specially created and optimised code improves PHP speed and serves static webpages more quickly than Apache. It can manage unexpected traffic spikes and assist in managing against DDOS assaults without any DDOS mitigation hardware.
Security
The built-in anti-DDoS functionality of LitSpeed Web Server is interoperable with Apache’s mod security module. With the use of programmable features like per-IP connectivity and bandwidth throttling, attackers may be stopped before they can overwhelm your server by blocking IPs that make too many connections, requests, or bandwidth demands.
Cost Effective
It is simple to go from Apache to LiteSpeed, and it is also quite affordable in terms of support fees. When compared to any hardware modifications necessary to optimize an Apache server, the license expenses for LiteSpeed are extremely affordable. Additionally, by offering an efficient, secure, and dependable hosting infrastructure, LiteSpeed’s special capabilities aid in lowering support costs. In turn, this provides administrators and support staff peace of mind rather than having to cope with a server that is overcrowded.
What is PHP memory_limit?
PHP has a per-script memory limit that is enough for all web applications and is just like a regular memory limit. PHP scripts would currently generate errors stating that the memory limit had been exceeded if they attempted to use more than 32MB (which is default limit in CyberPanel).
To see the RAM limit, use the phpinfo() function, and then adjust your server settings in accordance with the result. The memory limit on the server can be set to -1, which means that no memory is assigned to any measurement (not recommended).
PHP scripts are quite short. Unless you have a unique application that requires more resources in one script than most applications will ever need in their whole, each script should only occupy a minimal amount of RAM.
Why Does Memory Have a Limit?
The number of concurrent processes that may run may be limited by increasing each process’s memory. The maximum number of page requests you may serve at once depends on PHP processes.
The memory limit serves to put a hard halt on PHP processes when they go out of hand before they crash your server or use all of your monthly resource allocations.
Genuine PHP programs tend to be somewhat compact. Unless you have a particular application that requires more resources in one script than the majority of programs will ever need in their whole, each script should only occupy a minimal amount of RAM. These plugins are undoubtedly available, but they are uncommon.
If you’re out of memory, there’s a good probability that one of your PHP programs is corrupt or malicious, which causes the memory limit error to appear.
However, perhaps you truly are utilising a huge plugin that requires additional RAM. Even if you are not installing a particularly resource-intensive programme, the error may still show because certain web servers have the PHP memory limit set to an extremely low value.
You’ll rapidly run into the memory exhausted problem in any case.
How To Fix “LiteSpeed out of memory PHP” or “Fatal error: Out of memory” Error?
This “LiteSpeed out of memory PHP” problem is extremely easy to fix using CyberPanel. Now to fix this problem, whether you are using LiteSpeed Enterprise or OpenLiteSpeed, you need to know your PHP version. So to find that out;
First of all, go to your CyberPanel Dashboard
Click on Website -> List websites from the left hand side menu. This will show the complete list of all the websites that you are using
Now scroll down to your site and against it’s name, you will see Manage. Click on that
Scroll down to vHost Conf. Click on it and scroll down to find out your PHP version.
Now that you know about your PHP version, it is time to fix the “LiteSpeed out of memory PHP” problem.
Fix “LiteSpeed out of memory PHP” problem on OpenLiteSpeed
Open your CyberPanel Dashboard
Click on PHP -> Edit PHP Configs from the left hand side menu
Select your PHP from the provided drop down menu
Increase your memory limit, also increase max_execution_time, upload_max_filesize, post_max_size and max_input_time. Now Click Save.
This will solve your problem. But if not, then you would need to increase your memory soft limit and memory hard limit. For that,
First of all, go to your CyberPanel Dashboard
Click on Website -> List websites from the left hand side menu. This will show the complete list of all the websites that you are using
Now scroll down to your site and against it’s name, you will see Manage. Click on that
Scroll down to vHost Conf. Click on it and scroll down to find memory soft limit and memory hard limit. Increase both as much required and click save.
Fix “Fatal error: Out of memory” problem on LiteSpeed Enterprise
Open your CyberPanel Dashboard
Click on PHP -> Edit PHP Configs from the left hand side menu
Select your PHP from the provided drop down menu
Increase your memory limit, also increase max_execution_time, upload_max_filesize, post_max_size and max_input_time. Now Click Save.
This will Solve your Problem. But if not, then you would need to increase your memory soft limit and memory hard limit using LiteSpeed Web Server
To learn about how you can web admin access to your LiteSpeed Web Server click here.
Open your Web Admin
Click on Configurations from the top bar and select Servers
Click on External App from the provided second top bar
Find your PHP version (you should know your PHP version for this as discussed above) and click Edit.
Scroll down to find the Memory Soft Limit and Memory Hard Limit. Change these values and save the changes
Click on Graceful restart from the top and restart your PHP. This will definitely resolve the “LiteSpeed out of memory PHP”.
Conclusion
LiteSpeed Web Server is a powerful, high-performance web server application that can handle a lot of traffic. However, LiteSpeed may have an out-of-memory issue if it tries to use excessive amounts of RAM. You are not the only one who is encountering the LiteSpeed out-of-memory PHP issue. You may solve this problem with the aid of this article.