PHP CLI error_log file


i'm using a cron job like this:

$ php -d memory_limit=512M -f /home/user/cli/cron.php >/dev/null 2>&1

And this cron is running by root.

I'm not able to get some error log from this cron (perhaps is it in connection with this ">/dev/null 2>&1" ?).

With this command:

$ php -i | grep 'error_log'

i get this output:

error_log => no value => no value

Where are saved the error logs for PHP CLI scripts in Virtualmin?

Thanks, regards



Howdy -- the error logs are generated when accessing a website through Apache.

Apache catches any errors that occur, and then writes them to the logs.

When running a command on the command line, be it php or another command, those commands and their outcomes aren't logged.

If there is an error, the only way to know that would be to review the output generated by the command.

An alternative would be to use a command line tool such as wget or curl, and access that PHP script through Apache, if that particular user has a website.

It looks like you're using Virtualmin GPL there though... if you had any followup questions, you'd actually want to ask those in the Forums. We monitor the Forums, along with lots of wonderful folks in the community. Thanks!