Opencart needs mcrypt installed to work properlyy

I could not get the Opencart that is installed by Quick install to work properly, so I decided to do a manual install to see what’s going on:

https://opencart.soulyears.com/upload/install/index.php?route=step_2

As you can see, mcrypt is missing on the server. I tried apt install php-mcrypt to install it and then restared but that didn’t work as it is only good for versions of php prior to 7.2

After a bit of searching I found the following:

In servers with PHP version 7.2+, mcrypt is not available with it. So, first we install the mcrypt dependencies using the following command:

apt-get -y install gcc make autoconf libc-dev pkg-config
apt-get -y install php7.2-dev
apt-get -y install libmcrypt-dev

And to install mcrypt from PECL we use the command:

pecl install --nodeps mcrypt-snapshot

Further, we set the default prefix, edit the PHP configuration and restart service using:

sudo bash -c “echo extension=mcrypt.so > /etc/phpxx/conf.d/mcrypt.ini”
sudo service php-fpm restart

When I get to sudo bash -c “echo extension=mcrypt.so > /etc/phpxx/conf.d/mcrypt.ini” it fails:

root@vmi2077521:~# sudo bash -c “echo extension=mcrypt.so > /etc/phpxx/conf.d/mcrypt.ini”
bash: line 1: /etc/phpxx/conf.d/mcrypt.ini: No such file or directory

as does:

root@vmi2077521:~# sudo bash -c “echo extension=mcrypt.so > /etc/php8.2/conf.d/mcrypt.ini”
bash: line 1: /etc/php8.2/conf.d/mcrypt.ini: No such file or directory
root@vmi2077521:~#

Could you let me know the correct command please?

Those commands try to add a line to a file that doesn’t exist. And that file cannot be created because probably the directory does not exist.

The mcrypt-extension is deprecated will be removed in PHP 7.2 according to the comment posted here. So I am looking for an alternative way to encrypt passwords.

Right now I am using something like

Use a more up to date Opencast version…

Thanks for reply. I did some further research and need to add the following to php.ini extension=mcrypt.so

Could you let me know the correct command to add this to php.ini please?

mycrypt has been dropped in 7.2 so it would not work…

Use an older php versions/…

Kindly look at the following page…

mcrypt is now available as an extension that works with php 7.2 onwards and I have already installed it as above but just need the command line to add it to php.ini. if i add extension=mcrypt.so to php.ini it should work.

This is how I would get an idea of what directory php was configured out of

ps -ef | grep php

then there would be a php.ini in that directory

echo 'extension=mcrypt.so' > /etc/php/7.2/mods-available/mcrypt.ini
ln -s /etc/php/7.2/mods-available/mcrypt.ini /etc/php/7.2/fpm/conf.d/20-mcrypt.ini
ln -s /etc/php/7.2/mods-available/mcrypt.ini /etc/php/7.2/cli/conf.d/20-mcrypt.ini
systemctl restart php7.2-fpm

Thank you. That appears to have worked.

1 Like

Thanks. It returned the following: /et c/php/8.2/fpm/php-fpm.conf)

8.2 or 7.2 ?

8.2, it also lists details of 5.6 which i am using also

ok. I only have one version on mine. It looks like sahsanu helped you out with your 7.2 version. Pretty sure his solution is the same as editing the php.ini. I hope you got it all working

1 Like

Yes, it is :wink: It’s only a solution to avoid edit main php.ini but the result is the same.

1 Like

Yes, thanks, Opencart is working correctly for me now, happily.

1 Like