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. Creating a php.ini (phprc) file is the solution to adjust the PHP settings for your website.
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.
You can create a phprc file using an FTP client, or by logging into the server via SSH, however creating a phprc file is easier using an FTP client. This article uses Filezilla as the FTP client.
Adding a phprc file through Filezilla
- Log into your web server via FTP. Visit the following article for detailed instructions:
- Make sure you’re in your user's directory.
- You can see this in Filezilla in the ‘Remote site:’ field. It will say "/home/username".
- In the users directory, right-click your mouse and select Create directory.
- Name this directory .php. Make sure you add the period at the beginning of this folder name or it will not work. If you can’t see this directory, visit the following article on how to enable hidden files:
- Click into this new .php directory, and then create another directory.
- Create a folder named ‘5.6’.
Remember to first check which version of PHP your site is using. In this example, we’ll assume the site is using PHP 5.6. If your site is running PHP 7, the directory would be named 7.0 instead.
- The name of this directory is the version of PHP you’re using. In this example the site is running PHP 5.6.
- Click into this 5.6 folder, and then right-click and choose Create new file.
- Name the new file 'phprc'. DO NOT add a file extension, as the phprc file should never have an extension.
- Right-click on the phprc file, and then choose View/Edit.
- A default text editor opens for you to add your customizations. These examples are very general – adjust as needed for your site.
- When you try to save this file in Filezilla, the following pop-up box opens.
- Check the box which says ‘Finish editing and delete local file’, and then click the Yes button to save.
Killing off running PHP processes
After you've saved your changes, you should kill off all running PHP processes. This ensures your new settings are updated. View the following article for instructions on how to do this in your panel:
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:
The phprc file you just created is used for any domains under this specific username that are also running the specific version of PHP you chose in step#6 when creating the directory.
For example, if the user has three domain where two are running PHP 5.6 and the third is running PHP 7.0, only the first two domains running 5.6 would be affected by the phprc file. You would need to create a separate phprc file for the PHP 7.0 site.