My CakePHP console script is having problems executing under cron. It complains about missing Mysql connections and such.
After a little investigating I found that php run by cron uses a different php.ini file compared to when I run it in the terminal.
What's even more strange is that in the terminal, php does not use the cli config:
PHP run in the terminal:
Configuration File (php.ini) Path: /usr/local/lib Loaded Configuration File: /usr/local/lib/php.ini Scan for additional .ini files in: (none) Additional .ini files parsed: (none)
PHP run by cron:
Configuration File (php.ini) Path: /etc/php5/cli Loaded Configuration File: /etc/php5/cli/php.ini Scan for additional .ini files in: /etc/php5/cli/conf.d Additional .ini files parsed: /etc/php5/cli/conf.d/memcache.ini, /etc/php5/cli/conf.d/mysql.ini, /etc/php5/cli/conf.d/mysqli.ini, /etc/php5/cli/conf.d/pdo.ini, /etc/php5/cli/conf.d/pdo_mysql.ini, /etc/php5/cli/conf.d/suhosin.ini, /etc/php5/cli/conf.d/xcache.ini
I have no idea why it's not using the same config files. I don't notice anything special in the ENV
variables in the terminal or when run as cron.