Share your love
cPanel Error ‘PHP PECL imagick fails on PHP 8.3’ – Best Solution
You may encounter an issue while Installing PHP PECL imagick on PHP 8.3 in cPanel. In this tutorial, we try to provide a solution to fix the cPanel error: Installing PHP PECL imagick fails on PHP 8.3. Let’s start by understanding the PHP PECL imagick.
As you must know, PHP PECL “imagick” is a PHP extension that provides a set of functions to create, edit, and manipulate images using the ImageMagick image processing library. It allows PHP developers to work with images in different formats like JPEG, PNG, GIF, TIFF, etc.
Purpose of Using PHP PECL imagick: Here you can see some common reasons why we should use PHP PECL imagick:
- Broad Image Format Support: Imagick supports over 200 image formats. It is a powerful extension for different image-handling needs.
- Performance: It’s optimized for handling large images and complex operations.
- Advanced Image Processing: It ships with a lot of image editing features such as layers, masks, and effects that aren’t available with other libraries.
Now proceed to the following solution provided by the Orcacore website to fix this cPanel error on Installing PHP PECL imagick fails on PHP 8.3.
Table of Contents
Resolve cPanel Error: ‘Installing PHP PECL imagick fails on PHP 8.3’
The error I have got from Installing PHP PECL imagick fails on PHP 8.3 in cPanel looks like this:
Error
Unterminated preprocessor conditions
make: *** [Makefile:196: /root/tmp/pear/imagick/Imagick_arginfo.h] Error 1
ERROR: `make INSTALL_ROOT="/root/tmp/pear/pear-build-rootAsncgZ/install-imagick-3.7.0" install' failed
You can now follow the steps below to fix this issue.
Step 1 – Download the Latest Source Code of imagick PHP Extension
To resolve Installing PHP PECL imagick fails on PHP 8.3, you must download the latest imagick PHP. To do this, navigate to the /usr/src directory and use the following wget command to download it from GitHub:
# cd /usr/src
# wget https://codeload.github.com/Imagick/imagick/zip/refs/heads/master
Then, you must unzip your downloaded file and move it to the imagick file with the following commands:
# unzip master
# rm -rf master
# mv imagick-master imagick
Step 2 – Compile and Build PHP PECL imagick
At this step of Installing PHP PECL imagick fails on PHP 8.3, you must navigate to the imagick directory and prepare the PHP environment for compiling and installing PHP extensions from source. To do this, run the commands below:
# cd imagick
# /opt/cpanel/ea-php83/root/usr/bin/phpize
# ./configure --with-php-config=/opt/cpanel/ea-php83/root/usr/bin/php-config
Next, start your build and installation process with the commands below:
# make
# make test
# make install
Step 3 – Enable imagick PHP extension for PHP 8.3 on cPanel
At this point, you must enable the Imagick PHP extension for PHP 8.3 on a cPanel-managed server. To do this, you can run the command below:
echo "extension=imagick.so" >> /opt/cpanel/ea-php83/root/etc/php.d/imagick.ini
Finally, you must restart your web server:
service httpd restart #apache
/usr/local/lsws/bin/lswsctrl start #litespeed
Then, you can remove the imagick file:
cd ..
rm -fr imagick
That’s it, you have fixed Installing PHP PECL imagick fails on PHP 8.3.
Conclusion
With these steps, you should be able to resolve the cPanel issue of Installing PHP PECL imagick fails on PHP 8.3 successfully. Hope you enjoy it. For more cPanel guides and articles, you can check the cPanel Tutorials.
Also, you may like to read the following articles:
Disable or Hide Error Messages in PHP
Fix Exceeded LOCALRELAY limit* Error
Enable Custom Exim Mail HELOs in cPanel
Fix cPanel & WHM Installation on Red Hat 6 & 7
FAQs
What is causing the PHP PECL imagick installation to fail on PHP 8.3?
The most common reasons for the failure of the imagick installation on PHP 8.3 are:
– Missing dependencies, such as ImageMagick or development tools.
– Incompatibility of the imagick extension with PHP 8.3.
– Outdated PECL package or PHP configuration issues.
How do I enable the imagick extension after installing it?
As described in the guide steps, you can enable it with:echo "extension=imagick.so" >> /opt/cpanel/ea-php83/root/etc/php.d/imagick.ini
What is Imagick Extension?
The imagick extension acts as a bridge between PHP and ImageMagick. It allows PHP scripts to use ImageMagick’s capabilities through easy-to-use PHP functions.