Overview


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

1. Log into your web server via FTP. Visit the following article for detailed instructions:

⇰ FTP overview & credentials

2. 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".

Hosting FTP, Hosting phprc file

3. In the users directory, right-click your mouse and select Create directory.

Hosting FTP, Hosting phprc file

4. 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:

⇰ How do I show hidden files on my FTP client?

Hosting FTP, Hosting phprc file

5. Click into this new .php directory, and then create another directory.

Hosting FTP, Hosting phprc file

6. Create a folder named ‘5.6’.

The name of this directory is the version of PHP you’re using. In this example the site is running PHP 5.6.

Hosting FTP, Hosting phprc file

7. Click into this 5.6 folder, and then right-click and choose Create new file.

Hosting FTP, Hosting phprc file

8. Name the new file 'phprc'. DO NOT add a file extension, as the phprc file should never have an extension.

Hosting FTP, Hosting phprc file

9. 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.

Hosting FTP, Hosting phprc file

When you try to save this file in Filezilla, the following popup box opens.

Hosting FTP, Hosting phprc file

10. 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:

 How to update your phprc file in your panel

You can also update your phprc file by saving your domain configuration in your panel.

1. Navigate to the (Panel > 'Domains' > 'Manage Domains') page.

2. Click the Edit button to the right of your domain under the 'Web Hosting' column.

The 'Manage Domains' settings page opens:

3. In the first section, click the blue Change settings button.

⇰ This will update your phprc file within 10 minutes.
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:

My phprc file isn't updating


It’s possible that even if you’ve correctly added the phprc file, you may not notice its customizations resolving online. You may need to kill off all running PHP processes to ensure your new settings take effect.

Update your phprc file via SSH

1. Log into your server via SSH.
2. Once you log in, run the following command based on your version of PHP to kill off all running PHP processes:

For PHP 5.6:

[server]$ killall -9 php56.cgi

For PHP 7:

[server]$ killall -9 php70.cgi

Killing off your PHP processes in this way updates your phprc file.

0 comments:

Post a Comment

Facebook

Popular Posts

Blog Archive

Total Pageviews