I am attempting to install imagick and use it on my php project via xampp on Mac M1, i manage to install it using below steps
git clone https://github.com/Imagick/imagick
cd imagick
phpize && ./configure
make
sudo make install
And got the path of the imagick.so after building.
/bin/sh /Applications/XAMPP/xamppfiles/htdocs/imagick/imagick/libtool --mode=install cp ./imagick.la /Applications/XAMPP/xamppfiles/htdocs/imagick/imagick/modules
cp ./.libs/imagick.so /Applications/XAMPP/xamppfiles/htdocs/imagick/imagick/modules/imagick.so
cp ./.libs/imagick.lai /Applications/XAMPP/xamppfiles/htdocs/imagick/imagick/modules/imagick.la
Now i am trying to add it on my php.ini file using below methods
extension="imagick.so"
and
extension="/Applications/XAMPP/xamppfiles/htdocs/imagick/imagick/modules/imagick.so"
and
extension=/Applications/XAMPP/xamppfiles/htdocs/imagick/imagick/modules/imagick.so
after restarting the xampp and tried none of it worked, meaning it does not appear on my phpinfo modules and cannot instantiate new Imagick();
any advice
My Answer:
It seems like you may need to specify the full path to the imagick.so file in your php.ini file. Here are a few things you can try:
1. Make sure you are editing the correct php.ini file. You can find the location of the php.ini file by running `php --ini` in your terminal.
2. Instead of using the relative path, try using the full path to the imagick.so file in your php.ini file. For example:
extension="/Applications/XAMPP/xamppfiles/htdocs/imagick/imagick/modules/imagick.so"
3. Make sure that the extension_dir directive in your php.ini file is pointing to the correct directory where the imagick.so file is located. For example:
extension_dir = "/Applications/XAMPP/xamppfiles/htdocs/imagick/imagick/modules/"
4. After making changes to your php.ini file, make sure to restart your Apache server in XAMPP for the changes to take effect.
5. If the above steps do not work, you can try adding the extension dynamically in your PHP code using the `dl()` function. For example:
dl('/Applications/XAMPP/xamppfiles/htdocs/imagick/imagick/modules/imagick.so');
After trying these steps, check your phpinfo page again to see if the Imagick extension is loaded. If it still does not work, you may need to troubleshoot further or seek additional help from the Imagick community or XAMPP support.
Rate this post
4 of 5 based on 7663 votesComments