Wednesday, January 04, 2017

Call to undefined function mcrypt_encrypt() in ... on line ...

Call to undefined function mcrypt_encrypt() in ... on line ...


When porting from my local server to the live server for testing, the php page was not loading and returned an Error 500 or Internal Server Error.

Analyse Apache error logs


As a first step, we tried to analyse the apache error logs to shortlist the reasons. The following line seemed to hold the key to the problem.

PHP Fatal error:  Call to undefined function mcrypt_encrypt() in /path/to/myAppFolder/myFile.php on line 13

Identify the problem


Missing php-mcrypt module


The issue seems to be related to a missing module in the Centos server. The php program was using the php-mcrypt module and it was not yet installed on the server yet.

Install php-mcrypt and restart Apache


So, we installed the php-mcrypt module using the below command

sudo yum install php-mcrypt

As a final step, we restarted the Apache Web Server

sudo systemctl restart httpd

Calling the php program now does not generate error now. Problem of Call to undefined function mcrypt_encrypt()  SOLVED.

No comments:

Locking Unlocking Aadhar Biometrics, Lock Unlock

Recently, there was a news item, which claimed that we can lock and unlock our Aadhar biometric details from being requested for biometric ...

Copyrighted.com Registered & Protected DWYE-NHTO-NBNH-7FFM