Enabling PHP ImageMagick extension with IIS !

Prerequisites:

IIS 8.5 Installed

PHP 7.0.X ( 64 Bit) installed to C:\Program Files\PHP via WPI.

O.S :-  Windows Server 2012 / R2

We are about to  enable PHP ImageMagick extension with IIS

ImageMagick is free Open source software for displaying, editing image files in an easier way. It supports more than 200 image formats.

Step 1. Download ImageMagick

Go to http://imagemagick.org/script/binary-releases.php#windows and download ImageMagic exe file.

Step2. Installing of ImageMagick exe

Run the setup file (ImageMagick-6.9.3-7-Q16-x64-dll.exe ) .

Click I accept the agreement button & Click Next.

jo1

 

In the next window, click next and move on. You will be asked about the installation location.

 

jo2

It is recommend to change the default path ( C:\Program Files\ImageMagic x.x.x\ ) to any other folder in C drive. Otherwise it may not work properly.

Here I have created a folder call ‘IM’  in C drive &  is going to install ImageMagick into that folder.  Click Next after selecting the path.

Do not change the Options in the next window ( Select Additional Tasks). Leave it as default & click Next,

 

3

 

Click install in the next page and finish the installation.

Step 3 :- Adding proper DLL files into PHP extension folder.

Go to https://pecl.php.net/package/imagick and Download the proper DLL files forPHP.

From PHP 7.0.0, it supports 64-bit architecture. To find if your PHP is 64- bit or not, open PHP info window and search for Architecture.

Also it will be Thread safe OR Non-Thread safe. We can use phpinfo for this one too. Check for thread safety in phpinfo window, If thread safety is disabled then your PHP is Non-Thread safe.

Once you determine the correct PHP Type, download the appropriate dll files from the above mentioned link. Copy and paste it to PHP extension folder. ( In default – C:\Programfiles OR Program Files (x86) \PHP\v7.0\ext )

Once completed, restart your web server.  

After restarting, open IIS manager and look for PHP Manager in it. Double click on PHP Manager and open it. Then in right pan you can see a new window called PHP Setup.

If you are opening  PHP manager for the first time, then you will see a message. ( red circle in the following image )  . Click on that and enable all.

4

 

Then click on  ‘Enable OR Disable Extension’ tab and find for php_imagick.dll . Click on it then click Enable button in the right side panel to enable  ImageMagic Extension.

 

5

 

Once enabled, restart IIS.

Once completed, open phpinfo page. You will be able to see that imagick module is added with php.

cPanel upgrade fails from 11.54 – Services broken !

cPanel/WHM logo

A recent upgrade from cPanel / WHM 11.54 resulted in the services getting broken and not able to access the services.  Was able to find the following in the logs when attempt to restart cPanel was made :

Can’t locate Unix/PID/Tiny.pm in @INC (you may need to install the Unix::PID::Tiny module) (@INC contains: /usr/local/cpanel /usr/local/cpanel/3rdparty/perl/522/lib64/

The perl module Unix::PID::Tiny is missing which is causing the issues here. The fix would be to rebuild the RPM db.

Follow the steps given below to take backup of current RPM db and rebuild the RPM db:

cd /var/lib
mv rpm{,.old}
mkdir -p rpm
rpm --initdb
cp rpm.old/Packages rpm
rpm --rebuilddb

Kill the hanging RPM or upcp processes if any with the kill -9 $PID command. To find if there are any PIDs, run the following :

ps aux|grep rpm
ps aux|grep upcp

Once this is done, try for an upgrade :

/scripts/check_cpanel_rpms --fix
/scripts/upcp --force

Not able to delete files from file manager – Paper lantern theme

When cPanel is viewed using the Paper lantern theme, there was an error in which we were not able to delete any files over the file manager.

When loading over the Chrome, got the following in console :

utilities_container.js:13 Uncaught TypeError: Cannot set property ‘className’ of nullshow_panel @

As a workaround for this, tried re-installing the cPanel Paper lantern theme.

Removing Paper Lantern can be done by deleting its config folder or putting it in a separate folder.

#  mv /usr/local/cpanel/base/frontend/paper_lantern /root/jo

To re-install the theme simply run a cPanel update :

/scripts/upcp --force

This should fix the issue ! Atleast it worked for me 😀

cPanel service failing to start with a Perl error !

When trying to start the cPanel service via /scripts/restart_cpsrvd, was getting the following error :

cpsrvd: Setting up native SSL support … Can’t locate auto/Net/SSLeay/EC_KEY_new_.al in

The simple fix was to re-install the Net::SSLeay perl module

This can be done via SSH :

/scripts/perlinstaller Net::SSLeay

 

Installing MySQLnd in your cPanel server !

You might want to install the the MySQL native driver for PHP (MySQLnd) over the custom MySQL driver provided with the default EasyApache.

To enable this manually, you will need to edit the file :

/var/cpanel/easy/apache/rawopts/all_php5 and make sure the following entries are in place there :

–enable-mysqlnd
–with-mysqli=mysqlnd

Save the above file, run EasyApache from WHM and recompile as normal.

 

Fix – “Cannot load from mysql.proc, The table is probably corrupted”

For someone who upgraded MySQL from versions 5.0.x to something like 5.5.x, this error might be a familiar one :

“Cannot load from mysql.proc. The table is probably corrupted”

The database activities would not work as expected and hence you will need to fix this error at the earliest.

The recommended solution from MySQL is to run the mysql_upgrade script which examines all tables in all databases for incompatibilities with the current version of MySQL Server.

mysql_upgrade also upgrades the system tables so that you can take advantage of new privileges or capabilities that might have been added.

You can do this by :

# mysql_upgrade -u root

If you are using a cPanel based system, just run

# mysql_upgrade

To force the check, run

mysql_upgrade --force

Does this result in an error ? “”FATAL ERROR: Upgrade failed””

Look for the logs when this happens and try to spot if some invalid db folders are getting listed during the upgrade.

It might be something like :

mysqlcheck: Got error: 1102: Incorrect database name ‘#dbname#.bk’ when selecting the database

The above error indicates you have an invalid db under the mysql dbs folder, usually – /var/lib/mysql.

Navigate to /var/lib/mysql and find if there are any folders with any extension ( keep only valid db folders and move everything else, like backed up files or so from there )

Once this is complete, re-run the mysql_upgrade script !

 

Issue with horde in Plesk : Attachments not going through !

Once the Plesk panel gets updated to 11.5.x , the horde gets an upgrade as well : to horde 5.

On horde 5, there might be a weird issue in which mails would be sent out fine,  but any attachments would not be. You will not see any errors or warnings, however, the attachments will not be received at the other end.

The issue was , the temporary directory of horde had the wrong ownership of apache:apache. Change this to horde_sysuser:horde_sysgroup and things will be fine.

First check the location of temporary horde directory :

# grep -i tmpdir  /usr/share/psa-horde/config/conf.php

Most of the cases, it should be /tmp ( the default value )

# ls -la /tmp/ | grep .horde

Find the ownership of .horde and check if its apache:apache

Change it to :

# chown -R horde_sysuser:horde_sysgroup /tmp/.horde/
This should solve the problem with attachments !

 

 

Issue with r1soft backup agent !

Last day, got an issue which prevented a backup node to take the regular backup’s of a server which was already configured and working well.

The error which showed in backup node was :

Remote host unexpectedly closed the connection

Tried to stop the agent service running in the server and the error now obtained showed : “Connection refused

This meant that there was connections going through initially between the backup node and the concerned server, but somehow connection wasn’t getting established. Made sure the ports are opened and are listening in the server.

A quick grep on /var/log/messages showed the following :

Date hostname buagent: Was unable to create shared memory for log buffer

On checking the /etc/buagent/agent_config file, could see the CacheDir variable was set to : /var/cache/buagent

On trying to cd into the directory, was facing the error, ‘lots of symbolic links created’ and this error was preventing to enter in.

Removed the symlinks which is really not needed , re-created the folder/var/cache/buagent and attempted a backup task, bingo ! All good !!

 

 

 

 

Getting an empty /etc/userdomains file ?

Even though you have several domains, do you see an empty /etc/userdomains file ? This issue can pop up at times when your disk space gets filled up and the cPanel services malfunction. All you need to do is to update the cPanel domain- config files. This can be done by the script :

# /scripts/updateuserdomains

Now, you will be able to see the domains listed !