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 intend on making Global changes to your PHP configuration, you must UN-check the DreamHost Managed checkbox in your panel. Otherwise, your custom settings will be overwritten by the server next time a config is run.
Navigate to the Dedicated Servers Dashboard page. To the right of the server click the Configure button. On the next page, UN-check DreamHost Managed. Finally, click Save ds#### settings... at the bottom to save.
If you have a custom phprc file set up under your user, it 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 7.2
[server]$ cd /etc/php72
[server]$ cd /etc/php73
[server]$ cd /etc/php74
- 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/php#/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.