WHM/cPanel simplifies the process of installing PHP extensions like Imagick. In this guide, we will cover how to install Imagick on AlmaLinux 8 and 9, RockyLinux (latest versions), and CloudLinux 8 and 9, all of which are compatible with WHM/cPanel.
Table of Contents
- Prerequisites
- Installing Imagick on AlmaLinux 8 and 9 with WHM/cPanel
- Installing Imagick on RockyLinux with WHM/cPanel
- Installing Imagick on CloudLinux 8 and 9 with WHM/cPanel
- Verifying the Installation
- Common Issues and Troubleshooting
- Conclusion
1. Prerequisites
Before you begin, make sure you have:
- WHM/cPanel installed and running.
- Root access to your server.
- PHP installed on your server.
2. Installing Imagick on AlmaLinux 8 and 9 with WHM/cPanel
AlmaLinux is a RHEL-based distribution supported by WHM/cPanel. Here’s how to install Imagick using WHM:
Step 1: Log in to WHM
Access WHM by navigating to https://your-server-ip:2087/
. Use your root credentials to log in.
Step 2: Open EasyApache 4
From the WHM dashboard, search for “EasyApache 4” in the search bar and click on it.
Step 3: Customize Your PHP Installation
- In EasyApache 4, click Customize next to your current profile.
- Go to the PHP Extensions section.
Step 4: Search for Imagick
In the PHP Extensions section, search for “Imagick”. Select the PHP version you want to install Imagick for, and enable the Imagick extension by checking the box.
Step 5: Provision the Changes
After selecting Imagick, click on Review and then Provision to apply the changes. This will install Imagick for the selected PHP version.
Step 6: Restart Apache
Once the provisioning process is complete, restart Apache to ensure the changes take effect:
sudo systemctl restart httpd
3. Installing Imagick on RockyLinux with WHM/cPanel
RockyLinux, like AlmaLinux, is a RHEL-based distribution supported by WHM/cPanel. The installation process for Imagick is the same:
Step 1: Log in to WHM
Navigate to https://your-server-ip:2087/
and log in using your root credentials.
Step 2: Open EasyApache 4
Search for “EasyApache 4” in the WHM dashboard and open it.
Step 3: Customize Your PHP Installation
Click Customize next to your current profile, then go to the PHP Extensions section.
Step 4: Install Imagick
In the PHP Extensions section, search for “Imagick”. Select the appropriate PHP version and enable the Imagick extension by checking the box.
Step 5: Provision the Changes
Click Review and then Provision to install Imagick for the selected PHP version.
Step 6: Restart Apache
Restart Apache to finalize the installation:
sudo systemctl restart httpd
4. Installing Imagick on CloudLinux 8 and 9 with WHM/cPanel
CloudLinux offers additional features like CageFS and ALT-PHP, which require slightly different steps to install Imagick.
Step 1: Log in to WHM
Navigate to https://your-server-ip:2087/
and log in with root access.
Step 2: Open EasyApache 4
In the WHM dashboard, search for “EasyApache 4” and open it.
Step 3: Customize PHP Extensions
In EasyApache 4, click Customize next to your current profile and go to the PHP Extensions section.
Step 4: Install Imagick for Default PHP
Search for “Imagick”, select the PHP version you are using, and enable the Imagick extension by checking the box.
Step 5: Provision the Changes
Click Review and then Provision to install Imagick.
Step 6: Install Imagick for ALT-PHP Versions
For ALT-PHP versions, log in via SSH and run:
for version in alt-php{70,71,72,73,74,80,81}; do
yum install $version-pecl-imagick -y
done
Step 7: Update CageFS Skeleton
After installing for ALT-PHP, update the CageFS skeleton:
cagefsctl --force-update
Step 8: Restart Apache
Restart Apache to complete the installation:
sudo systemctl restart httpd
5. Verifying the Installation
To verify that Imagick is installed and working, follow these steps:
Step 1: Create a PHP Info File
Create a simple PHP file to check if Imagick is enabled:
echo "<?php phpinfo();" | sudo tee /usr/local/apache/htdocs/info.php
Step 2: Access the PHP Info Page
Open your browser and navigate to http://your-server-ip/info.php
. Look for the Imagick section to confirm it is installed.
Step 3: Remove the PHP Info File
For security reasons, remove the PHP info file after checking:
sudo rm /usr/local/apache/htdocs/info.php
6. Common Issues and Troubleshooting
Issue 1: Imagick Not Appearing in PHP Info
Solution:
- Ensure the Imagick extension is enabled for the correct PHP version in EasyApache 4.
- Verify that Apache has been restarted after installing Imagick.
Issue 2: Multiple PHP Versions and ALT-PHP
Solution:
- For CloudLinux, make sure to install Imagick for all ALT-PHP versions using the command provided.
- Use WHM MultiPHP Manager to manage different PHP versions.
Issue 3: CageFS Not Reflecting Imagick
Solution:
- Update the CageFS skeleton using
cagefsctl --force-update
to ensure that new changes are applied to all users.
7. Conclusion
Installing Imagick on AlmaLinux, RockyLinux, and CloudLinux using WHM/cPanel is straightforward thanks to EasyApache 4. By following these steps, you can ensure that Imagick is properly installed and configured for your PHP environment, enabling advanced image processing capabilities for your websites and applications. Make sure to verify your installation by checking the PHP info page, and address any issues with the troubleshooting tips provided.