Pages

Thursday, December 28, 2023

Install Imagick on Cpanel Server

Imagick is a PHP extension that utilizes the ImageMagick software suite for image processing. It's widely used for creating, editing, composing, and converting images. This guide will take you through the steps of installing ImageMagick and the Imagick PHP extension on a cPanel server.

Step 1: Installing ImageMagick

1. Access Your Server:
Log in to your server as the root user via SSH:

ssh root@server

2. Navigate to the Source Directory:

cd /usr/local/src/

3. Download ImageMagick:

wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz

4. Extract the Archive:

tar zxvf ImageMagick.tar.gz

5. Configure and Install:

Navigate to the ImageMagick directory (the name might vary based on the version):

cd ImageMagick-*

Now, compile and install ImageMagick:

./configure make make install

6. Install Perl Module:

If you need PerlMagick, the Perl interface for ImageMagick, continue with these steps:

cd PerlMagick perl Makefile.PL make make install

7. Confirm ImageMagick Installation:

Verify that ImageMagick is installed:

which convert

Expected output: /usr/local/bin/convert

Step 2: Installing Imagick PHP Extension

1. Download Imagick for PHP:

wget http://pecl.php.net/get/imagick-2.3.0.tgz

2. Extract the Archive:

tar -zxvf imagick-2.3.0.tgz

3. Navigate to the Imagick Directory:

cd imagick-2.3.0

4. Prepare Imagick for PHP:

phpize ./configure make make install

5. Update PHP Configuration:

Edit the php.ini file used by your PHP installation. The location of this file can vary, but typically it's found in /usr/local/lib/php.ini:

vi /usr/local/lib/php.ini

6. Add Imagick Extension:

In the php.ini file, add the following line to enable the Imagick extension:

extension="imagick.so"

Save and close the file.

Step 3: Restart the Web Server

After updating the PHP configuration, restart Apache to apply changes:

/scripts/restartsrv_httpd

Conclusion

You've successfully installed ImageMagick and the Imagick PHP extension on your cPanel server. This setup allows you to leverage powerful image processing capabilities directly from PHP scripts. Test the installation by running a PHP script that utilizes Imagick functions to ensure everything is working correctly. Remember to regularly update both ImageMagick and the Imagick extension to maintain security and functionality.

Setting EST Timezone on Red Hat Machines

Adjusting the timezone of your server to Eastern Standard Time (EST) can be crucial for synchronization in multi-regional operations. Here is a straightforward guide on how to set your Red Hat machine to use EST as the current timezone.

Step 1: Access Your Server

Log in to your Red Hat server as the root user:

ssh root@server

Ensure you have the necessary permissions to make changes to system configurations.

Step 2: Update the Timezone

Red Hat and most Unix-like operating systems store timezone data in /usr/share/zoneinfo/. The /etc/localtime file is a symbolic link or a copy of the file representing the current timezone.

Copy EST Timezone File:

  1. Navigate to the root directory:

    cd /
  2. Copy the EST timezone file to /etc/localtime:

    cp /usr/share/zoneinfo/EST /etc/localtime

    Confirm to overwrite the existing /etc/localtime file when prompted.

Step 3: Verify the Change

After updating the timezone file, verify that the change was successful:

date

The output should display the current date and time in the EST timezone, for example, Thu May 13 12:38:16 EST 2010.

Note on Daylight Saving Time

It's important to note that EST does not automatically adjust for Daylight Saving Time (DST). If you require automatic DST adjustments, consider using a city-based timezone in the America directory that follows EST and adjusts for DST, such as New_York. For example:

cp /usr/share/zoneinfo/America/New_York /etc/localtime

Conclusion

You've now successfully set your Red Hat machine to operate in the Eastern Standard Time timezone. This change will help ensure that your server's time is in sync with EST, which is crucial for log accuracy, scheduled tasks, and other time-sensitive operations. Remember, timezone settings are essential for the proper functioning of various network protocols and system operations, so always double-check these settings during system setups or migrations.