Welcome Guest, Not a member yet? Register   Sign In
CLI call behaves incorrectly when called from cron, yet works fine from command line
#2

[eluser]bientek[/eluser]
This is solved with a wrapper script that the cron job called (rather than having the cron job call php directly).

On my CentOS server, the PHP wrapper script needs some environment variables set up, such as terminal type. Here is the wrapper script that cron calls:

Code:
#!/bin/bash
/usr/bin/env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin COLUMNS=72 /usr/local/bin/php -c /usr/local/lib/php.ini /path/to/code/index.php cron_jobs

Thanks to John S, the Linux admin at HostGator who provided this solution.


Messages In This Thread
CLI call behaves incorrectly when called from cron, yet works fine from command line - by El Forum - 08-30-2012, 06:13 AM



Theme © iAndrew 2016 - Forum software by © MyBB