I’m trying to run my chat bot with cron (every minute):
/usr/bin/php7.2 /home/admin/web/cavrljanje.com/public_html/addons/adnoyer/system/cron/adnoyer.php >/dev/null 2>&1
and I got error from Cron daemon:
Cron [email protected] /usr/bin/php7.2 /home/admin/web/cavrljanje.com/public_html/addons/adnoyer/system/cron/adnoyer.php
Site error: the ionCube PHP Loader needs to be installed. This is a widely used PHP extension for running ionCube protected PHP code, website security and malware blocking.
Ok, the problem is clear. But I’ve installed ionCube for php 7.2 as you can see here: https://cavrljanje.com/aws7.php
Just to config
Please run php7.2 /path/to/aws7.php to check if ioncube is loaded…
I could be that ioncube is loaded only in fpm. You will need to load module as well in /etc/php/7.2/cli/conf.d
This is just a ouput of phpinfo(); what exactly happens if you trigger the script manualy? Will it also fail?
Check if 00-ioncube-loader.ini is loaded in
If not copy
Thanks @eris, I’ve missed that. -
Here is solution for “future generations” with this problem from scratch:
tar -xvzf ioncube_loaders_lin_x86-64.tar.gz
php7.2 -i | grep extension_dir
cp ioncube_loader_lin_7.2.so /usr/lib/php/20170718
echo 'zend_extension=ioncube_loader_lin_7.2.so' > /etc/php/7.2/fpm/conf.d/00-ioncube-loader.ini
echo 'zend_extension=ioncube_loader_lin_7.2.so' > /etc/php/7.2/cli/conf.d/00-ioncube-loader.ini
service php7.2-fpm restart
hey @Amadex, glad you figured it out.
let me add something for other readers just to be more clear about what happened here:
when using /usr/bin/php in cron to run scripts, it will use settings and modules from the phps CLI config, while the webserver itself accesses php through FPM.
so, if you add additional modules like ioncube, you need to make sure to add them to both, your fpm and cli config (see above ;-))