Overview
This article explains how to add PHP extensions and loaders to your website.
Background
Extensions
PHP Extensions are libraries of pre-built code. They allow you to use specific functions already created to simplify your code. See this page for a list of PHP Extensions.
Loaders
PHP Loaders add special types of PHP files that have been encoded with an encoding product such as ionCube Loader.
Checking if an extension is active
Before adding an extension, make sure it's not already activated by default. You can view any active extension by adding a phpinfo.php file to your site.
If an extension is active, you'll see its corresponding block when visiting the phpinfo.php file. For example, search for the word Phar, and you see Phar: PHP Archive support and enabled.
Adding an extension
The steps in this section add code to your user's phprc file to enable an extension.
Create a phprc file
See the following articles for instructions on how to create a phprc file:
If the file already exists, you just need to update it using either an FTP client or SSH:
Load the extension
Add a line to your phprc file to load an extension using this syntax:
extension = extension_name.so
Kill off all running PHP processes
Make sure to kill running php processes to ensure your new settings take effect.
Confirm your changes
After you've edited the file and killed off all PHP processes, check to confirm the extension has been enabled by creating a phpinfo.php file. When you view this file in a browser, you should see the extension listed.
If you do not see your changes have updated, try killing off all 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, if using PHP 8.3 run the following:
[server]$ php /usr/local/php83/bin/phpize
WebP
Support for the WebP image format is available via GD, which is activated by default on DreamHost servers.