Table of Contents
π 1 minute read
Multi-Method Extension Verification for Debugging
When debugging missing PHP extension errors in Docker, use multiple verification methods to confirm what’s actually installed vs what the application can see.
Method 1: List All Loaded Modules
docker exec my-app php -m
Method 2: Runtime Check via PHP Code
docker exec my-app php -r "echo extension_loaded('redis') ? 'YES' : 'NO';"
Method 3: Check php.ini Configuration
docker exec my-app php --ini
# Shows which ini files are loaded
Method 4: Test Actual Function Availability
docker exec my-app php -r "var_dump(function_exists('redis_connect'));"
Why Multiple Methods?
php -mshows modules PHP knows aboutextension_loaded()checks if the extension is active in the current context- Function checks verify the extension’s API is actually usable
In debugging sessions, cross-reference all three to isolate whether the issue is installation, configuration, or application-level detection.
Pro tip: If php -m shows the extension but extension_loaded() returns false, check your php.ini configuration and verify the extension is enabled for the SAPI you’re using (CLI vs FPM).
Leave a Reply