Why doesn't cron execute my PHP script correctly?

I have a PHP script (just a simple script) and I'm trying to run it as a cronjob. Every time it executes a PHP script, I get mail from the PHP script itself.

How can i solve this? I searched a lot on Google, but can't find anything that works.

+7
source share
1 answer

In the DirectAdmin panel, go to the "cronjobs" section, I assume that you have already set the time interval for your cronjob, so you just need to configure the "command" parameter, so try:

First option:

/usr/bin/php -f /home/your_user/public_html/your_script.php 

This way you will call the php script using the php interpreter.

The second option:

 lynx -source http://yourdomain.com/your_script.php 

This way you will perform a text interpretation of the lynx web browser and open the required URL so that you can run the php script. Lynx is installed by default on most Linux servers.

I also believe that there is an option in the DirecAdmin cronjobs section called "Prevent Email" so that you do not receive emails.

+8
source

All Articles