Every installation of PHP comes with default settings which are usually fine for most websites. Occasionally, the needs of a website makes it necessary to adjust these PHP settings. For example, your site may need to increase the memory limit to allow a process to complete. In that case, you would need to create a php.ini (phprc) file and update this value.
The DreamHost phprc file
The standard term for a PHP configuration file is php.ini. However, DreamHost uses the term "phprc" file instead. This acts the same way – only the name is different. In this article, only the term phprc is used.
Some variables (in particular,
upload_max_filesize) are subject to internal limitations; increasing them significantly beyond the default values will not work correctly and will cause issues with your site.
Why increase the PHP memory limit?
PHP allows a default amount of memory to be used when processing a website. Sometimes, a website needs more than the default amount of memory. If that's the case, you can increase it to fit the needs of your site.
You may also receive an error on your site indicating that the memory limit has been reached. It may appear like this:
Fatal error: Allowed memory size of 94371840 bytes exhausted (tried to allocate 5072 bytes)
This error means your site needs more memory than is currently available. If you see an error like this, try increasing your memory limit by 10MB. Then continue to adjust as necessary.
Increasing the PHP memory limit
The default memory limit is 90M and this is usually more than sufficient for most needs. If you need to raise this limit, you must create a phprc file. View the following articles for instructions on how to create a phprc file.
If the file already exists, view the following articles for instructions on how to update it (depending on if you're using an FTP client or SSH):
If you wish to increase this limit, add the following line:
memory_limit = 128M
If you find you're increasing the memory a large amount, it's time to consider moving off of shared hosting, as your website has greater needs than shared hosting can reliably provide.
Kill off all running php processes
Make sure to kill running php processes to ensure your new settings take effect.
Confirming your changes
After you've edited the file and killed off all PHP processes, you should check to confirm the values have updated. You can do this by creating a phpinfo.php file.
If you do not see your changes have updated, try killing off your PHP processes again:
- php.ini overview
- SSH overview
- How do I enable PHP error logging?
- How do I increase the PHP upload limit?
- How do I enable PHP extensions and loaders?
- How do I make global phprc changes on a Dedicated server?
- My phprc file isn't updating
- Where can I view PHP errors and warnings?
- Cannot modify header information