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 upload files larger than the current PHP upload limit allows. In that case, you would need to create a php.ini (phprc) file and update this value. If you have a Dedicated server it’s possible to set a single phprc file for the entire server, rather than set them up individually for each site.
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.
How to enable global changes
If you still have a custom phprc file setup under your user, this will override the global php.ini file for that specific user for the version of PHP for which the custom phprc file was created.
- Log into your server via SSH, using your admin user. You can create an admin user at 'Dedicated' > 'Admin Users'.
- Once you log into your server, navigate to the directory for the version of PHP you wish to edit:
For PHP 5.6
[server]$ cd /etc/php56
[server]$ cd /etc/php70
[server]$ cd /etc/php71
[server]$ cd /etc/php72
- Once you are in that directory, you’ll see the php.ini file.
- Run the following command to edit it:
[server]$ sudo nano php.ini
- When finished editing, close the file and return to your shell.
- Kill off any PHP processes to update the file.
Once you finish, the global php.ini is now used for all sites on your server which do not have a custom phprc file enabled.
If your server is running NGINX, you must stop NGINX before killing PHP, then restart it. The following commands can only be run on a Dedicated server with an admin user.
To stop/kill/restart NGINX:
[server]$ sudo /etc/init.d/nginx stop [server]$ pkill -9 php [server]$ sudo /etc/init.d/nginx start
Loading PHP extensions on all domains (on VPS or dedicated)
On a DreamHost VPS or Dedicated server, you can find the directory at
/etc/php56/conf.d/ (just make sure to change the php# folder to the actual version you’re updating). Any files in this directory are loaded by all PHP interpreters for this version of PHP.