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.
Loaders and Extensions
PHP Loaders are extensions to PHP which load special types of PHP files that have been encoded with an encoding product such as ionCube Loader.
To activate the loader, you must add a line to your phprc file. Below are links to pages that provide further instructions on installing and using the various PHP loaders:
PHP Extensions are libraries of pre-built code. They allow you to use specific functions already created to simplify your code. The following is a current list of PHP Extensions:
Some extensions are already activated by default (such as Phar). Others are not, but can be activated by adding a line to your phprc file.
Checking if an Extension is already active
Before adding an extension, make sure it's not already activated by default. For example, the Phar extension is already activate with any version of PHP at DreamHost. If you then add the phar.so extension to your phprc file, your site will thrown an error, so it's important to only add an extension if needed.
You can view any currently active extension by adding a phpinfo.php file to your site.
If an extension is already active, you'll see its corresponding block when visiting the phpinfo.php file. For example, this shows that the Phar extension is active.
Adding an extension
Step 1 — Create a phprc file
View the following articles for instructions on how to create a phprc file:
If the file already exists, view the following articles for instructions on how to update it (depending on if you're using an FTP client or SSH):
Step 2 — Load the extension
To load an extension, add the following line your phprc file (make sure to change extension_name to the actual extension.):
extension = extension_name.so
Step 3 — Kill off all running php processes
Make sure to kill running php processes to ensure your new settings take effect.
Step 4 — Confirming your changes
After you've edited the file and killed off all PHP processes, check to confirm the extension has been enabled. You can do this by creating a phpinfo.php file. You should see the following:
If you do not see your changes have updated, try killing off your PHP processes again:
Compiling PHP extensions
Some extensions are not complied with PHP. In these instances, you must download the extension and compile it manually.
Visit the following links for a list of available extensions:
If any installation requires sudo privileges, you must upgrade to a Dedicated Server.
If any installation requires you to run phpize, just specify the full path to your desired version of PHP. This command can be run in any directory. For example, for PHP 7.4 run the following:
[server]$ php /usr/local/php74/bin/phpize
You can use different versions of PHP if needed. For example.
[server]$ php /usr/local/php72/bin/phpize [server]$ php /usr/local/php73/bin/phpize [server]$ php /usr/local/php74/bin/phpize [server]$ php /usr/local/php80/bin/phpize
Starting with PHP 7.2.11, hash.so is built into PHP. If you're using this version or higher, you should no longer call it from your phprc file.
Support for mcrypt has been removed starting with PHP 7.2.0. Any scripts that depend on mcrypt will need to be updated to use OpenSSL or Sodium instead.
Support for the WebP image format is available via GD, which is activated by default on DreamHost servers.