Execute PHP via cron - No Input file specified

后端 未结 6 1238
醉梦人生
醉梦人生 2021-01-14 02:13

I\'m using the following command to execute a PHP file via cron

php -q /home/seilings/public_html/dvd/cron/mailer.php

The problem is that I

6条回答
  •  半阙折子戏
    2021-01-14 03:06

    Enviroment variable such as HTTP_HOST exists only when you're running php scrints under web server. But you can add it manually in your crontab config:

    ## somewhere in crontab config
    HTTP_HOST=somthing.com
    15 * * * * /path/to/your/script > /dev/null 2>&1
    

    This will enable your script to think that it's running on production enviroment.

提交回复
热议问题