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.

Comments

Popular posts from this blog

Steps to install wkhtmltopdf in Centos 7 Redhat

Error when setting up _ installing MCrypt PHP Extension on Redhat 7 Enterprise x64

The Perils of ECR Chennai