Hello and welcome to the world of PHP customizing! If you’re a site owner or developer, you already are aware that PHP is the basis of numerous dynamic applications and websites. It’s the language that provides interaction and flexibility to your web applications. It’s true that PHP isn’t without limitations. Sometimes these limits might be too restricting for what you need.
That’s where we can help. In this complete guide, we’ll guide you through the process of changing PHP limits in two well-known control panels for web hosting: DirectAdmin and cPanel. If you’re experiencing problems with memory allocation and execution time restrictions or any other PHP-related issues We’ve got you covered.
At the end of this course, you’ll have the understanding and confidence to tweak your PHP settings to ensure that your web applications function smoothly and effectively.
What are PHP memory Limits?
PHP memory limits are how much memory an PHP application or script can use while running on the web server. These limits are specified within the configuration of the server’s PHP setting and are vital to ensure safety and stability of web-based applications.
PHP limitations on memory are crucial settings to control how much memory PHP scripts will make use of during the execution.
Monitoring and configuring these limits can ensure stability security, stability, and maximum performance of web-based applications running on servers.
Reasons for limitations in PHP Memory?
Limitations in PHP memory prevent the PHP scripts from using excessive memory and potentially collapsing the server. By default, the PHP memory is set to a low scale like-*** MB to check the same.
There are several reasons why it is necessary to limit the memory of PHP scripts:
- By limiting the memory, a user can ensure that PHP scripts do not use excessive space thereby exhausting the server and adversely impacting the performance.
- Limiting the PHP memory also helps prevent the innumerable loops that take place due to programming errors.
- Setting a Memory limit for PHP scripts is important for maintaining the stability of the system.
- It also enables the users to reduce the chances of security attacks.
With that being said, let’s study the correlation between the PHP memory limits and Website Performance.
Are PHP Memory Limits and Website Performance co-Related?
Yes! The PHP memory limits and website Performance are closely related to each other.
PHP memory limits are set to avoid unnecessary loops created due to programming error, which ends up consuming more and more memory.
Furthermore, the memory limits secure the website from attacks like BufferOverflow and many more. Limiting the PHP memory limits thereby boosts the website performance and in turn increases the productivity level.
It may be noted that setting the PHP memory limit too low may cause legitimate scripts to fail if they require more memory. In such a case what should a User ought to do? Increase the PHP Memory limit?
Yes, you heard that right. Increasing the PHP memory limit can include the legitimate scripts thereby stabilizing the server.
It is recommended to analyze the memory usage patterns of PHP scripts and gradually increase the memory limit, if necessary while also optimizing your content and minimizing memory usage wherever possible.
How to Increase PHP Memory Limit in DirectAdmin?
Let’s now see how users(especially the VPS hosting plan holders), required to include more valid scripts than what previous memory limitations provided, can increase the PHP memory limit in DirectPanel in the following ways:
Go to the official website of your hosting service > Login to access your customer area dashboard.
- Go to my services > click the domain whose PHP memory you need to increase.
- Click the Login to DirectAdmin option to access the Direct admin of your hosting plan.
- Go to Account Manager > Click the PHP Settings.
- At first, you will see a list of PHP versions installed on your server > Select the version you want to modify.
- On Clicking the above option > the Add New Override pops up > Drag Down the setting option > Select the Memory_limit option.
- By default, it may have a value like 64MB which represents the memory limit > Select the size of the memory limit you desire to increase from the Value field > press the ADD option.
- The changes get successfully configured thereafter with a green message flashing on the screen.
After saving the changes, you may need to restart your web server for the new memory limit to take the initiative.
Users (especially the shared hosting plans holder) can also Increase PHP memory limit by adopting the following methods:
Go to the official website of your hosting service > Login to access your customer area dashboard.
- Go to my services > click the domain whose PHP memory limit you need to modify.
- Click the Login to DirectAdmin option to access the DirectAdmin of your shared hosting plan.
- Scroll down to click Select PHP Version under the Extra Features tab.
- Select the PHP version you want to modify > Click the options tab.
- Drag down the Memory Limit > Select the desired memory limit from among the options provided.
- Drag Down the Post_Max_Size > Select the desired post size from the options.
- Drag Down the Upload_Max_Filesize > Select the desired post size from the options.
- The modifications get successfully configured with a green message flash on the screen.
For users’ suitability, we have defined Post_Max_Size and Upload_Max_Filesize in simpler words.
(The maximum size in bytes of data that can be posted online is called Post_Max_Size. It should be larger than upload_Max_Size and smaller than Memory_Limit.)
(The Maximum size in bytes of an uploaded file is called Uploaded_Max_Filesize.)
How to Increase PHP Memory Limit in cPanel?
Now to increase the PHP memory limit in cPanel. One needs to adopt the measures given below:
Go to the official website of your hosting service > Login to access your customer area dashboard.
- Login to your cPanel account.
- Scroll down further to the Software tab > Click on the Select PHP Version option.
- First, you will see a list of PHP versions installed on your server > Select the desired PHP version for which you want to increase the memory limit.
- On selecting the PHP version > Click on the Switch to PHP options button.
- In the PHP option page > search for the memory_limit > By default it may be set to a lower value > set the memory to your desired size.
- Drag Down the Post_Max_Size > Select the desired post size from the options.
- Drag Down the Upload_Max_Filesize > Select the desired post size from the options.
- The changes get saved and signaled with a green notification flash on the screen.
- The new PHP limit is now applied to your website.
Note from the writer: Keep in mind that increasing the PHP memory limit should be done cautiously. Allocating too much memory to PHP may affect the overall website performance thereby exhausting the web server.
PHP memory limits offered by YouStable?
The PHP predefined memory limit offered by YouStable is from 64MB to 1024 MB. By default, the memory limit of the PHP script is kept at the lowest to avoid servers breaking down due to excessive storage.