I'm already desperate, I know there are a lot of similar questions but no solution helped me, so I'll try a new question.
I'm trying to activate Imagick but I get this error
Warning: PHP Startup: Unable to load dynamic library 'imagick.so' (tried: /opt/homebrew/lib/php/pecl/20210902/imagick.so (dlopen(/opt/homebrew/lib/php/pecl/20210902/imagick.so, 0x0009): symbol not found in flat namespace '_AcquireAlignedMemory'), /opt/homebrew/lib/php/pecl/20210902/imagick.so.so (dlopen(/opt/homebrew/lib/php/pecl/20210902/imagick.so.so, 0x0009): tried: '/opt/homebrew/lib/php/pecl/20210902/imagick.so.so' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/lib/php/pecl/20210902/imagick.so.so' (no such file), '/opt/homebrew/lib/php/pecl/20210902/imagick.so.so' (no such file))) in Unknown on line 0
I've installed it with this order:
brew install imagemagick
brew install pkg-config
pecl install imagick
Also in php.ini I have it enabled:
extension="imagick.so"
Imagick is installed correctly:
convert --version 127 ✘ 11:39:56
Version: ImageMagick 7.1.1-12 Q16-HDRI aarch64 21239 https://imagemagick.org
Copyright: (C) 1999 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenMP(5.0)
Delegates (built-in): bzlib fontconfig freetype gslib heic jng jp2 jpeg jxl lcms lqr ltdl lzma openexr png ps raw tiff webp xml zlib
Compiler: gcc (4.2)
And imagick.so
is placed correctly:
-rw-r--r-- 1 jklimcik admin 494967 Jul 14 10:08 /opt/homebrew/lib/php/pecl/20210902/imagick.so
What am I missing or what's wrong? I am using MacOS 13.4, Apple M1 Pro. I'm also using Laravel Valet, but I don't think it's related to this issue.
So I solved it after a few hours and thanks to @hakre's poke. The problem was my migration to the M1 chip. As it has a different architecture (arm) it caused a lot of problems. In the end I had to remove everything related to homebrew and install everything from scratch. I keep it here as it may be useful for others if they have a similar problem.