cPanel cron job, no input file specified?

£可爱£侵袭症+ 提交于 2019-12-23 17:31:44

问题


I've just set up my first cron-jon to run a stock script every night. Running it manually works fine.

It's stored in /admin/stock_update.php

The command i'm running is /usr/bin/php -q /admin/stock_update.php

But I'm getting emails saying no input file is specified? Any ideas?

Cheers


回答1:


Network services almost never expose actual paths on the server's hard disk drive and even if they could it isn't a behaviour you can rely on. So the fact that your file is located at /admin/stock_update.php in the FTP server doesn't say much about actual location on disk, which is what local command-line utilities expect.

In PHP, you can find path on disk of current file with the __FILE__ magic constant. You can create a test script:

<?php
var_dump(__FILE__);

... upload it to the same FTP location and execute through the web server. If that's not an option because files in your FTP account in not visible from the web you can run the file from cron and check the email.




回答2:


Do you have CloudLinux kernel installed on that server and CageFS filestyem? If yes try running this:

cagefsctl -w cpaneluser; cagefsctl -m cpaneluser

Then try running the cron again



来源:https://stackoverflow.com/questions/37678223/cpanel-cron-job-no-input-file-specified

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!