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 activate 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
For example, this is what you would add to enable the intl extension.
extension = intl.so
Below is a list of common extensions you may need to add to your phprc file.
|Extension||Line in phprc file|
|curl||extension = curl.so|
|fileinfo||Already enabled by default|
|imagick||extension = imagick.so|
|intl||extension = intl.so|
|mysqli||extension = mysqli.so|
|phar||Already enabled by default|
|zip||extension = zip.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. For example, for PHP 5.6 run the following:
You can use different versions of PHP if needed. For example.
[server]$ /usr/local/php70/bin/phpize [server]$ /usr/local/php71/bin/phpize [server]$ /usr/local/php72/bin/phpize [server]$ /usr/local/php73/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.