Fix PHP Extensions Not Loading in LiteSpeed Web Server
Fix PHP Extensions Not Loading in LiteSpeed Web Server The Problem After installing PHP extensions via apt-get on LiteSpeed (e.g., lsphp82-curl, lsphp82-intl), the extensions don’t appear in phpinfo() even though: The .ini files exist in /usr/local/lsws/lsphp82/etc/php/8.2/mods-available/ The extensions load correctly via CLI (php -m shows them) LiteSpeed has been restarted The Cause LiteSpeed’s PHP scans the mods-available directory for .ini files, but files without a numeric prefix may be ignored during the loading process. When you install extensions via apt, they create files like curl.ini and intl.ini. However, PHP/LiteSpeed preferentially loads files with numeric prefixes (e.g., 20-curl.ini, 40-igbinary.ini). The Solution 1. Rename the .ini files with a numeric prefix cd /usr/local/lsws/lsphp82/etc/php/8.2/mods-available/ # Rename curl.ini mv curl.ini 20-curl.ini # Rename intl.ini mv intl.ini 20-intl.ini # Repeat for any other extensions not loading The number determines load order (lower = earlier). Use 20- for most extensions to ensure they load before dependencies. 2. Restart LiteSpeed /usr/local/lsws/bin/lswsctrl restart Or for a full stop/start: /usr/local/lsws/bin/lswsctrl stop /usr/local/lsws/bin/lswsctrl start 3. Verify Check phpinfo() in your browser. The “Additional .ini files parsed” section should now include your renamed files: Additional .ini files parsed: /usr/local/lsws/lsphp82/etc/php/8.2/mods-available/20-curl.ini, /usr/local/lsws/lsphp82/etc/php/8.2/mods-available/20-intl.ini, … Quick Diagnostic Commands # List all .ini files in mods-available