Thursday, 14 December 2023

Laravel Class Imagick not found

The error "Class 'Imagick' not found" in Laravel typically indicates that the Imagick PHP extension is not installed or enabled on your server. Imagick is an image manipulation library that provides advanced capabilities for image processing. Here’s how you can resolve this issue:

1. Install Imagick PHP Extension

First, you need to install the Imagick PHP extension on your server. The installation steps can vary depending on your operating system.

For Ubuntu/Debian:

sudo apt-get update
sudo apt-get install php-imagick

For CentOS/RHEL:

sudo yum install php-imagick

For Windows:

  • Download the appropriate DLL file from PECL or windows.php.net.
  • Place the DLL file in your PHP extension directory.
  • Update your php.ini file to include the extension: extension=php_imagick.dll.

2. Enable the Imagick Extension

After installing, you need to enable the Imagick extension in your PHP configuration.

  • Open your php.ini file.

  • Add the following line:

extension=imagick

If you have multiple PHP versions, ensure you are modifying the php.ini file for the correct version.

3. Restart Your Web Server

After installing and enabling Imagick, restart your web server to apply the changes.

For Apache:

sudo service apache2 restart

4. Verify Installation

To verify that Imagick is installed and enabled, you can create a PHP file with the following content and navigate to it in your web browser:

phpinfo();

Look for the Imagick section in the phpinfo() output. If it's listed, then Imagick is successfully installed and enabled.


No comments:

Post a Comment

Laravel csrf token mismatch for ajax post request

Error "CSRF Token Mismatch" commonly occurs if tokens do not match in both sessions and sent , and received requests.CSRF token he...