How Do I Increase PHP Memory Limit?
Experiencing PHP memory errors on your web hosting plan can cripple your website's performance. If you're seeing these errors and need a quick fix, this guide is for you. Learn how to effortlessly increase your PHP memory limit for your website or online store with our step-by-step instructions. Optimizing your website's performance and eliminating these errors is within reach with just a few simple adjustments.
- How do I modify the PHP settings in my package?
- Customizing PHP on Windows Hosting Packages
- Are there any specific settings to include in the php.ini file?
- Do I need to change the file permissions once it is uploaded?
- How quickly do the new settings take effect?
- Where can I go for more information on settings for the php.ini file?
- What is the file name and type I would make?
With our Web Hosting package, you can modify the default PHP settings for your package. Default values for PHP are modified with a custom php.ini file that can be created and then uploaded into the cgi-bin folder of the hosting package's root folder.
Our support staff cannot provide support for modifications to the php.ini file. Therefore, we strongly recommend that you back up any existing php.ini files, if one exists, before making modifications. To make these changes, you will need access to the server via an FTP client and access Notepad on a PC or textEdit on a Mac.
How do I modify the PHP settings in my package?
Increase Your PHP Memoy Limit on Shared Hosting (Step-by-Step Guide):
- Connect to your server via FTP. Utilize an FTP client to establish a connection to your shared hosting server.
- Navigate to the /cgi-bin directory within your website's root folder. If a php.ini file already exist, download if for editing. Otherwise, create a new text file and name it exactly php.ini (ensure its lowercase).
- Open the downloaded php.ini (or the newly created one) using a text editor.
- Increase the memory limit. Add the following line to the php.ini file, replacing 128M with your desired memory limit (e.g., 256M):
memory_limit = 128M
Important: When increasing the memory limit, be cautious. Allocate only the amount your website requires for proper operation. Excessive memoy usage can negatively impact server performance. - Upload the php.ini file. Upload the edited php.ini file back to the /cgi-bin folder on your server.
- Delete php.ini.coalesced (if necessary): In some cases, you might need to delete the php.ini.coalesced file located in the /cgi-bin/.php folder. This ensures your custom settings take effect.
- After uploading php.ini, visit a PHP page. You should see better performance if the memory limit was the issue.
Customizing PHP on Windows Hosting Packages
To implement PHP changes, create a .user.ini file and place it in the www (root web) folder. The format of the file should mirror that of a Unix package, allowing settings like memory_limit=128M to take effect almost immediately.
Are there any specific settings to include in the php.ini file?
The settings in the /cgi-bin/php.ini override all of the settings from the server's php.ini. You should include all settings as listed above.
Do I need to change the file permissions once it is uploaded?
Once the file is uploaded, the default permissions will allow it to function without any changes. For security reasons, we recommend resetting the file permissions to the lowest possible level that still permits operation, which is 500 (-r-x --- ---).
How quickly do the new settings take effect?
The new settings take effect once you delete the php.ini.coalesced file within the /cgi-bin/.php folder; otherwise, the changes are instant. You can verify your settings by using a standard PHP info command, run from a typical PHP file in the /htdocs folder. For more details, visit the PHP documentation page.
Where can I go for more information on settings for the php.ini file?
For more information on php.ini settings, check out the PHP documentation about php.ini directives on the PHP Release website. Additionally, you can search the term php.ini using any major search engine.
What is the file name and type I would make?
The file name is case sensitive and should be php.ini—all lowercase. The file type is a standard text document with no encoding. You do not call functions as in PHP code but define settings as documented in the example.