Local Community

PHP 7.4.1 and Windows 10 lead to WP-CLI: Warning: PHP Startup: Unable to load dynamic library 'php_imagick.dll'

Issue Summary

WP CLI and Composer display PHP extension error messages for the php_imagick.dll extension. This happens after clicking “Open Site Shell” or running commands, such as wp cli version or composer --version.

Weirdly enough, C:\Users\Hannah\AppData\Roaming\Local\lightning-services\php-7.4.1+16\bin\win64\ext\php_imagick.dll exists at the searched path.

Troubleshooting Questions

Does this happen for all sites in Local, or just one in particular?

  • This is only happening to sites using PHP 7.4.1, not PHP 7.3.5.

Are you able to create a new, plain WordPress site in Local and access it in a Browser?

  • Yes.

Replication

  1. Create new local site.
  2. Set PHP version to 7.3.5.
  3. Start the site.
  4. Right-click on the site and select “Open Site Shell”.
  5. Notice no PHP errors.
  6. Select PHP version 7.4.1 and click APPLY.
  7. Right-click on the site and select “Open Site Shell”.
  8. Notice below WP CLI and PHP errors.
WP-CLI: Warning: PHP Startup: Unable to load dynamic library 'php_imagick.dll' (tried: C:/Users/Hannah/AppData/Roaming/Local/lightning-services/php-7.4.1+16/bin/win64/ext\php_imagick.dll (The specified module could not be found.), C:/Users/Hannah/AppData/Roaming/Local/lightning-services/php-7.4.1+16/bin/win64/ext\php_php_imagick.dll.dll (The specified module could not be found.)) in Unknown on line 0
WP-CLI: WP-CLI 2.5.0-alpha
// ...
Composer: Composer version 1.10.8 2020-06-24 21:23:30
PHP: Warning: PHP Startup: Unable to load dynamic library 'php_imagick.dll' (tried: C:/Users/Hannah/AppData/Roaming/Local/lightning-services/php-7.4.1+16/bin/win64/ext\php_imagick.dll (The specified module could not be found.), C:/Users/Hannah/AppData/Roaming/Local/lightning-services/php-7.4.1+16/bin/win64/ext\php_php_imagick.dll.dll (The specified module could not be found.)) in Unknown on line 0
PHP: 7.4.1
MySQL: mysql  Ver 8.0.16 for Win64 on x86_64 (MySQL Community Server - GPL)

System Details

Which version of Local is being used?

  • Local 6.0.0+5444

What Operating System (OS) and OS version is being used?

  • Microsoft Office 10 (10.0.19041 Build 19041)

Attach the Local Log. See this Community Forum post for instructions on how to do so:

  • Unfortunately, no log was created by this error.

Similar Issues

Already tried

Stopped and restarted Local after each change.

  • I tried adding extension=php_imagick.dll to the {{#if os.windows}} block in E:\PROJECTS\local-sites\testagain\conf\php\php.ini.hbs file, but the errors persist.
    • This also caused an error on the Overview dashboard: Warning: Module 'imagick' already loaded in Unknown on line 05.7.2.
  • Adding C:\Users\Hannah\AppData\Roaming\Local\lightning-services\php-7.4.1+16\bin\win64 to the system PATH did not help either. Even restarted the computer for good measure.

I also am having this issue. I’ve just updated to Local 6.1.2 and the issue persists with PHP 7.4.1, but is not present with PHP 7.3.5.

Since the errors also referenced a file named php_php_imagick.dll.dll, I made a copy of the existing .dll file and named it to match, but that didn’t help either.

I am also on Windows 10. There is nothing in the Local log files.

Problem still present in LocalWP v6.1.4+5521, only applicable to php 7.4.1 (.16 in my case)

The weird thing is; the error shows a file path to the php_imagick.dll and that file exists. it is present and exists in the correct location.
I also tried a full path to the dll and that does not help.

I changed the php.ini.hbs file to read extension=php_gd2.dll, a file in the same directory as php_imagick.dll, and then I got “module gd already loaded” so I KNOW the config file is correct, PHP knows where to find the modules.

I copied php_imagick.dll to php_i.dll and set that in the php.ini, same error “module not found”
I then copied php_gd2.dll to php_i.dll; “module already loaded”
This confirms that the php.ini.hbs changes are correct and the file path is evaluated without problems; the problem is the DLL file itself.

I then proceeded to download several (read: almost all x64) versions from windows.php.net, all versions of the dll responded the same … except for 2.
The 3.5.0-7.4-nts-vc15-x64 and 3.4.4-7.4-nts-vc15-x64 versions of the dll do not produce the error and load perfectly fine.

So there is a solution; https://windows.php.net/downloads/pecl/releases/imagick/3.5.0/php_imagick-3.5.0-7.4-nts-vc15-x64.zip (or https://windows.php.net/downloads/pecl/releases/imagick/3.4.4/php_imagick-3.4.4-7.4-nts-vc15-x64.zip)

I cannot tell if this is the solution. I don’t know what the differences between ‘ts’ and ‘nts’ are, I don’t know why the 3.5.0 nts and 3.4.4 nts versions do work, but the 3.5.1 nts version does not and neither do older versions or ts versions. All I know is; 3.5.0 and 3.4.4 nts versions work, the rest don’t.

R.
(p.s. I typed the URLs by hand, because, two computers, so please forgive typos)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.