Knowledge Base
MilesWeb / Web Hosting FAQ

Steps to Create a phprc file via SSH

Approx. read time : 2 min

Each of the PHP installation comes with default settings that are generally fine for most websites. It’s very rare when the requirements of a website, make it essential for adjusting the PHP settings. In this case creating a php.ini (phprc) file is the solution for adjusting the PHP settings for your website.

In standard term, php.ini is used for a PHP configuration file.

A phprc file can be created using an FTP client, or by logging into the server via SSH, but it would be easy to create a phprc file using an FTP client. This article explains the steps to create this phprc file via SSH.

Steps to Add a phprc file using SSH

1. Using SSH, log into your server.

2. Type ‘pwd’ to confirm that you are in your users directory:

In this directory, a single command can be run to create the /.php folder as well as the /7.2 folder that is present inside of it. Remember to first check the version of PHP your site is using. In the below example, we have assumed that the site is using PHP 7.2. If your site is running PHP 7.1, name the directory as 7.1 instead.

3. Execute the below command:

4. Run the below code to change your directory into these two new folders you just created:

  • After running pwd, you will see the entire filepath you just created:

5. Create the phprc file without an extension, in this folder.

You can run a few programs for creating this file. In this example, a program called nano is used.

6. Execute the below code to create the phprc file:

A text editor will pop up.

7. Next, edit the file with the help of your PHP customizations.

8. Close the file and go back to your shell.

How to Kill off running PHP processes?

After saving your changes, it is essential to kill off all running PHP processes. This helps your new settings to get updated.

How to Confirm Your Changes?

After editing the file and killing off all PHP processes, it is important to confirm if the values have updated. This can be done by creating a phpinfo.php file.

If your changes aren’t updated, try killing off your PHP processes again.

Conclusion

The phprc file is used for any domains under this specific username which also run the specific version of PHP you selected in step#3 while creating the directory.

For example, if the user has three domains from which two are running PHP 7.2 and the third is running PHP 7.1, only the first two domains that run 7.2 would be affected by the phprc file. You will need to create a separate phprc file for the PHP 7.1 site.

Also Read:

How To Login to Your Server By SSH?

How to Create and Edit a File via SSH?

Steps to Perform When the phprc file isn’t Updating

Avatar
Pallavi is a Digital Marketing Executive at MilesWeb and has an experience of over 4 years in content development. She is interested in writing engaging content on business, technology, web hosting and other topics related to information technology.
Need help? We’re always here for you.