Sometimes your web application requires a custom PHP extension that isn’t enabled by default in your virtual hosting environment. Fortunately, most hosting providers allow you to add or enable extensions manually.
Check Hosting Support
Log into your hosting control panel (e.g., cPanel, DirectAdmin, Plesk) and look for Select PHP Version or PHP Extensions. Many providers let you enable extensions with a single click.
Upload Custom Extension
If the needed extension is not available, you can:
Download the extension .so (Linux) or .dll (Windows) file compatible with your PHP version.
Upload it to a directory on your hosting account (commonly /php/ext/).
Edit php.ini or .user.ini
Add a line pointing to the extension file:
For local configs, use .user.ini
in your site’s root directory.
Restart or Reload PHP
On shared hosting with LiteSpeed or Apache + PHP-FPM, simply wait a few minutes or restart via the panel.
Verify Installation
Create a phpinfo.php file with:
Open it in your browser and confirm that the extension is listed.
Adding your own PHP extension in virtual hosting usually involves enabling it through the control panel or manually configuring php.ini
. Always ensure compatibility with your hosting’s PHP version to avoid errors.