我刚刚设置了我的第一个cron-jon,每天晚上运行一次股票脚本。 手动运行它可以正常工作。
I've just set up my first cron-jon to run a stock script every night. Running it manually works fine.
它存储在/admin/stock_update.php
It's stored in /admin/stock_update.php
我正在运行的命令是 / usr / bin / php -q /admin/stock_update.php
但是我正在收到电子邮件,提示未指定输入文件? 有什么想法吗?
But I'm getting emails saying no input file is specified? Any ideas?
欢呼声
推荐答案网络服务几乎永远不会公开服务器硬盘驱动器上的实际路径,即使可以,这也不是您可以依靠的行为。因此,您的文件位于FTP服务器中的 /admin/stock_update.php 的事实并不能说明磁盘上的实际位置,这就是本地命令行
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.
在PHP中,您可以使用 __ FILE __ 魔术常数在当前文件的磁盘上找到路径。您可以创建一个测试脚本:
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__);...将其上传到相同的FTP位置并通过Web服务器执行。如果由于无法从网络上看不到FTP帐户中的文件而导致无法选择,则可以从cron运行文件并检查电子邮件。
... 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.
更多推荐
cPanel cron作业,未指定输入文件?
发布评论