Symfony 自定义任务在托管上不起作用

发布于 2024-10-09 04:12:19 字数 176 浏览 1 评论 0原文

我创建了一个自定义任务,该任务在我的开发计算机上运行良好,但是当我将其上传到服务器时,我收到以下消息。

任务“project:update-countries”不是 已定义。

是否需要进行任何其他设置才能运行?

谢谢你, 拉杜。

I created a custom task which works fine on my development machine, but when i uploaded it to the server i get the message bellow.

Task "project:update-countries" is not
defined.

Are there any other settings to make so it can run?

Thank you,
Radu.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

夜访吸血鬼 2024-10-16 04:12:19

将当前工作目录更改为项目的根目录,然后在其中运行命令。在你的 crontab 中,它应该如下所示:

*/15 * * * * cd /path/to/project; time php symfony project:update-countries

Change your current working directory to the project's root, and run the command there. In your crontab, it should look like this:

*/15 * * * * cd /path/to/project; time php symfony project:update-countries
開玄 2024-10-16 04:12:19

确保上传任务的文件名如下所示:

namespace + task name + "Task.class.php"

Ex: projectUpdateCountriesTask.class.php

不同的名称会导致 Symfony 不接受,因此即使在文件中指定了所需的命名空间和文件名,该任务也不会出现在任务的内部列表中。

Make sure that the filename of the uploaded task looks like this:

namespace + task name + "Task.class.php"

Ex: projectUpdateCountriesTask.class.php

Different names results to be not accepted by Symfony so the task will not appear in the internal list of tasks even if in the file was specified the desired namespace and filename.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文