Wasn't able to use the magick CLI, found the answer

I’ve been trying to get the latest ImageMagic working so I can convert AVIF on my server. I finally found the fix to get this AVIF Local Support working.

Here’s the short post-mortem.

What was wrong

  • Symptom: WordPress plugin reported /usr/local/bin/magick was not executable, even though the binary existed, was 0755, and worked on the CLI.

  • Root cause: The site’s vhost-level open_basedir (in OpenLiteSpeed, managed via CyberPanel) restricted PHP file access to:

    /tmp:/home/daviddegner.com/
    

    Because /usr/local/bin wasn’t in open_basedir, is_executable('/usr/local/bin/magick') returned no. Many plugins check is_executable() and bail out, so CLI ImageMagick calls were blocked from PHP—even though magick -version could sometimes still execute.

How we found it

  1. Confirmed LSPHP’s real php.ini and globals:

    /usr/local/lsws/lsphp83/bin/php -i | egrep 'Loaded Configuration|open_basedir|disable_functions'
    

    → Global open_basedir was OK, so the problem wasn’t the system-wide ini.

  2. Created a tiny PHP page (web context) showing:

    • php_sapi_name()litespeed
    • ini_get('open_basedir')/tmp:/home/daviddegner.com/too narrow
    • is_executable('/usr/local/bin/magick')no

    That proved a vhost override was in effect.

The fix

Update the vhost’s PHP admin value for open_basedir to include the ImageMagick paths.

In CyberPanel → Websites → [site] → vHost Conf, set:

phpIniOverride  {
  php_admin_value open_basedir "/tmp:$VH_ROOT:/usr/local/bin:/usr/local/lib"
}

Important syntax: no = after php_admin_value.
$VH_ROOT expands to your site root (safer than hard-coding the full path).

Then restart LiteSpeed.

How to verify

  • Reload your test page:

    • open_basedir now shows /tmp:...:/usr/local/bin:/usr/local/lib
    • is_executable('/usr/local/bin/magick')yes
  • Re-run the plugin’s diagnostics.

Why this happens a lot

  • CyberPanel/OLS often sets a tight open_basedir per site for security.
  • Editing the global php.ini (or CyberPanel global PHP configs) doesn’t help if the vhost still overrides it.
  • Plugins commonly require is_executable() to pass before using a CLI tool.

Quick checklist for others

  1. Permissions: chmod 755 /usr/local/bin/magick (and convert symlink).
  2. Libraries: ldd /usr/local/bin/magick → no “not found”.
  3. Which php.ini? Use LSPHP to check (lsphp83/bin/php -i).
  4. Web context test: a PHP page printing SAPI, open_basedir, disable_functions, is_executable().
  5. If blocked: widen vhost open_basedir to include /usr/local/bin and /usr/local/lib (and site paths).
  6. Restart LiteSpeed and retest.

Optional workaround

If you can’t change open_basedir, create a wrapper inside the allowed path and point the plugin to it:

/home/your-site/bin/magick -> exec /usr/local/bin/magick "$@"

(Then ensure /home/your-site/bin is within open_basedir.)

That’s it—vhost-level open_basedir was the blocker; widening it fixed the plugin’s executability check.