Verify ImageMagick installation without SSH access
Relying on hosting provider announcements that a library like ImageMagick is "pre-installed" is often an unreliable heuristic. Without shell access to run php -m or inspect system logs, you are forced to interrogate the PHP runtime itself. The absence of an entry in the standard phpinfo() output is a definitive signal that the PHP-FPM process cannot locate the ImageMagick shared objects, regardless of whether the binary exists on the filesystem.
When you search for "ImageMagick" within the generated phpinfo() page and find nothing, it usually means one of two things: either the extension was never compiled into your specific PHP build, or the installation paths were not correctly configured when the module was enabled. Since you cannot SSH into the server to verify file permissions or check /etc/php/*/mods-available/, you must treat this as a binary state failure within the PHP environment.
The most direct way to confirm the presence of ImageMagick in PHP is by checking the gd extension status, which often wraps ImageMagick functionality via the imagick extension. You can add a snippet to your phpinfo() output or use a dedicated function to check this. However, simply looking for the string "ImageMagick" is insufficient because the library might be installed but not loaded as an extension.
If you are using a framework like Laravel, the situation changes slightly because the framework attempts to autoload extensions dynamically if they exist. To verify the installation programmatically without relying on the visual output of phpinfo(), you can create a simple test file that attempts to instantiate the Imagick class. If the constructor throws an exception regarding a missing extension, ImageMagick is definitely not available in the current PHP environment.
<?php
try {
$imagick = new Imagick();
echo "ImageMagick is successfully loaded.\n";
} catch (Exception $e) {
echo "ImageMagick is NOT installed or not enabled: " . $e->getMessage() . "\n";
}
This approach bypasses the ambiguity of text searches within phpinfo() and provides a clear binary result. If the output indicates that the class is missing, you are dealing with a missing extension rather than a misconfiguration of an existing one. In a shared hosting environment where you lack root privileges, enabling this extension often requires contacting support with specific instructions on which PHP version (e.g., 7.4, 8.0, or 8.1) the server is running, as ImageMagick requires different build flags for each version.
Another pitfall to consider is the distinction between the system-level binary and the PHP extension. The hosting provider might have installed imagemagick via apt-get or yum, making the command-line tool available to you if you could run shell commands, but the PHP extension (imagick.so) remains absent. This is a common source of confusion where developers assume that because the CLI tool works, the PHP integration will function automatically. It does not; they are separate components with separate dependencies.
Furthermore, even if the extension loads successfully, phpinfo() sometimes omits detailed version strings for ImageMagick unless you specifically query the imagick section or check the gd section if using that wrapper. If you see an entry under "Registered PHP Streams" or similar sections in phpinfo() referencing Imagick, that is a positive sign. However, the absence of any mention does not definitively prove it isn't installed; it just means it hasn't been loaded by the current PHP binary.
If your application relies on image manipulation libraries like Spatie's Image or Laravel Intervention Image, these packages will fail gracefully if ImageMagick is missing, but they might default to GD if configured to do so. To ensure you aren't relying on a fallback that degrades performance or quality, you should explicitly check for the Imagick extension before attempting heavy image processing tasks in your application logic.
For teams managing large-scale deployments where SSH access is restricted, integrating a health check endpoint that runs this verification script and returns a JSON status can be a robust solution. This allows developers to verify infrastructure dependencies programmatically without needing deep visibility into the server's internal state.
