How to Install ImageMagick for ALT-PHP

Installing ImageMagick for ALT-PHP, an alternative PHP stack provided by CloudLinux, allows you to manipulate images efficiently within your PHP applications. Here’s a comprehensive guide on how to install ImageMagick for ALT-PHP:

 

 Prerequisites:

 

  1. ALT-PHP Installed: Ensure that your server is running CloudLinux and ALT-PHP is installed. ALT-PHP provides alternative PHP versions and configurations.

 

  1. Root Access: You need root access or sudo privileges on your server to install ImageMagick.

 

 Installation Steps:

 

  1. Update System Packages:

   Before installing ImageMagick, it’s recommended to update your system’s package repositories:

  1. Install ImageMagick:

   CloudLinux provides a utility called `cl-install-image-magick` to install ImageMagick for ALT-PHP. Run the following command in your terminal:

This command installs ImageMagick and its dependencies specifically for ALT-PHP.

 

  1. Verify Installation:

   Once the installation is complete, verify that ImageMagick is installed correctly by checking its version:

You should see the version information for ImageMagick displayed in the output.

 

 Configuration Steps:

 

  1. Enable ImageMagick Extension:

   After installing ImageMagick, you need to enable the ImageMagick extension for ALT-PHP. Edit the ALT-PHP configuration file:

Replace `XX` with the ALT-PHP version you are using (e.g., `74` for ALT-PHP 7.4).

 

  1. Add the following line to the configuration file:

Save the file and exit the editor.

 

  1. Restart Apache or LiteSpeed:

   After enabling the ImageMagick extension, restart the web server for the changes to take effect:

or

 Testing ImageMagick:

 

To ensure that ImageMagick is working correctly with ALT-PHP, you can create a simple PHP script to test it:

 

  1. Create a new PHP file, for example, `test.php`, in your web server’s document root:
  1. Access this PHP file via a web browser. If ImageMagick is configured correctly, you should see a red square image displayed.

 

You have successfully installed and configured ImageMagick for ALT-PHP on your CloudLinux server. ImageMagick enables you to perform a variety of image manipulation tasks within your PHP applications, enhancing their functionality and visual appeal. Make sure to test ImageMagick thoroughly to ensure compatibility and optimal performance with your web applications.