cPanel cron作业,未指定输入文件?

编程入门 行业动态 更新时间:2024-10-22 19:36:38
本文介绍了cPanel cron作业,未指定输入文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我刚刚设置了我的第一个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作业,未指定输入文件?

本文发布于:2023-10-31 15:47:24,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1546548.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:作业   文件   cPanel   cron

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!