How to Change the PHP Memory limit for Scripts

Like almost everything that runs on computers, PHP memory limit for scripts needs memory (RAM) to operate. In case of unavailability of sufficient memory, it can cause some scripts to fail, resulting in error messages instead of working web pages.


If you encounter errors such as �Fatal error allowed memory size of X bytes exhausted� then you may need to raise your PHP memory limits.


How to Increase PHP Memory Limits for scripts

It's essential to understand that increasing the amount of memory each PHP process can use decreases the number of concurrent processes that can run. 


How to Increase PHP Memory Limits for php.ini

Step 1: Go to the hosting summary and log in to your account.



Step 2: Click the hosting summary available on the left pane. After that, click the Scripting Config. Link.


Step 3: From the Scripting Config. page, click on Manage PHP Scripting.



Step 4: Click on Manage php.ini mention under Actions tab.



Step 5:In the php.ini file, locate memory_limit=



Step 6: Make the changes as per your needs and click on Save button.



Step 7: A pop-up message will appear with the message the change has been saved.



How to Increase PHP Memory Limits via SPanel


Step 1. Log in to your SPanel dashboard.

Step 2. Go under the �Tools� section and click on �PHP INI Editor� under the �Tools� section.

Step 3. Choose the domain for which you want to adjust memory limits.

Step 4. Under �memory_limit� replace the existing value of the field with the new one. 

How to Increase PHP Memory Limits via cPanel

Step 1: Log into cPanel.

Step 2: Navigate through the SOFTWARE section and click on Select PHP version

Step 3: After that, a new window appears, click on the Switch To PHP Options button.

Step 4: Here you can locate the memory_limit and click on the value.

Here, you get a dropdown menu or text input box that allows you to change the value as required. To find the correct value, check your script, plugin, or theme�s documentation.

Step 5: Once you�ll make the change, the new value will be updated automatically. Once you successfully changed the value, you will see a message that will confirm that the change has been done.

How to increase PHP memory limit in DirectAdmin


In order to increase your PHP memory limit in DirectAdmin you need to follow these simple steps:


Step 1: To change the PHP memory limit in DirectAdmin, you need to edit the php.ini file but before that, you need to navigate it. A effortless and advanced trick to find your php.ini would be is ask to PHP itself what it's using, e.g.:


/usr/local/bin/php --ini | grep 'Loaded Configuration File'


If you're continuing with the default version of CLI PHP, the location of your php.ini will be as follows:


/usr/local/lib/php.ini


Step 2: As per your needs you will edit the �memory_limit� to your desired values. If no "memory_limit" is found, then at the end of php.ini, add the following below-mentioned line 


memory_limit = 128M; /* here you can change the 128M with any number you need  */ and Save the file.


Step 3: Now, restart Apache.


If you would like to escalate the maximum post data size:


post_max_size = 8M


If you would like to convert the maximum allowed size for uploaded files:


upload_max_filesize = 2M

Conclusion

The PHP memory limit existence is good for a reason. In the absence of this, a poorly written script can easily finish all of your server resources and cause many issues. 


Hence,  wish to utilize more of your resources towards PHP scripts, you can change the maximum allocated memory for each script by simply editing a configuration file. This informative write-up showed you how to change the PHP memory limit for scripts. In case of any queries or suggestions, please leave your message in the comment section below.


Was this answer helpful? #7 #5
 

Did We Miss Out on Something?

Relax, we have you covered. At Go4hosting, we go the extra mile to keep our customers satisfied. We are always looking out for opportunities to offer our customers “extra” with every service. Contact our technical helpdesk and we’d be more than happy to assist you with your Cloud hosting, Colocation Server, VPS hosting, dedicated Server or reseller hosting setup. Get in touch with us and we’d cover all your hosting needs, however bizarre they might be.

Related Questions

Submit your Query

  • I'm not a robot

Browse by ServicesBrowse by Services

Resource Library

What is Cloud Computing

Understand the term cloud computing, the ongoing trend, its playing field, future growth and how industry...

Myths about Cloud Computing

Cloud computing, in the recent years, has become a subject of significant discussion among the industry experts.

Download Now

Did We Miss Out on Something?

Relax, we have you covered. At Go4hosting, we go the extra mile to keep our customers satisfied. We are always looking out for opportunities to offer our customers “extra” with every service. Contact our technical helpdesk and we’d be more than happy to assist you with your Cloud hosting, Colocation Server, VPS hosting, dedicated Server or reseller hosting setup. Get in touch with us and we’d cover all your hosting needs, however bizarre they might be.

Submit Query

Please fill in the form below and we will contact you within 24 hours.