Magento 定时任务

编程入门 行业动态 更新时间:2024-10-28 06:31:51
本文介绍了Magento 定时任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我已将我的服务器 (CPanel) 配置为每 5 分钟在 magento 根文件夹中运行 cron.sh.但它不起作用并且数据库中的 cron_schedule 表是空的.这是我的 config.xml

I have configured my server (CPanel) to run cron.sh in magento root folder every 5 min. But it doesnt works and cron_schedule table in database is empty. Here is my config.xml

<config> <modules> <Company_Facebookreview> <version>1.0.0</version> </Company_Facebookreview> </modules> <global> <models> <facebookreview> <class>Company_Facebookreview_Model</class> <resourceModel>facebookreview_mysql4</resourceModel> </facebookreview> <facebookreview_mysql4> <class>Company_Facebookreview_Model_Mysql4</class> <entities> <facebookreview> <table>facebookreview</table> </facebookreview> </entities> </facebookreview_mysql4> </models> <resources> <facebookreview_setup> <setup> <module>Company_Facebookreview</module> <class>Mage_Sales_Model_Resource_Setup</class> </setup> </facebookreview_setup> </resources> <helpers> ... </helpers> <blocks> ... </blocks> <events> <sales_order_place_after> <observers> <place_order_after> <type>singleton</type> <class>Company_Facebookreview_Model_Observer</class> <method>save</method> </place_order_after> </observers> </sales_order_place_after> </events> </global> <crontab> <jobs> <facebookreview> <schedule> <cron_expr>*/5 * * * *</cron_expr> </schedule> <run> <model>facebookreview/observer::methodName</model> </run> </facebookreview> </jobs> </crontab>

这是我的公司/Facebookreview/Model/Observer.php

and here is my Company/Facebookreview/Model/Observer.php

class Company_Facebookreview_Model_Observer extends Varien_Event_Observer { public function save(Varien_Event_Observer $observer) { } public function methodName($schedule) { Mage::log('cron working fine');//cache is disabled and var folder has 777 permissions and var folder hasnt log folder } }

缓存被禁用,var 文件夹有 777 权限,var 文件夹没有日志文件夹.我正在使用 Magento 社区 1.9.我做错了什么?请帮忙...

cache is disabled and var folder has 777 permissions and var folder hasnt log folder. I am using Magento Comunity 1.9. What i am doing wrong ? please help...

推荐答案

我有两个建议.

更新 cron.php

如果您使用的是 Magento 1.8,那么这将解释您需要做什么:www.a2hosting/kb/installable-applications/optimization-and-configuration/magento1/cron-jobs-do-not-run-on-magento-1-8-after-upgrade

If you're using Magento 1.8, then this will explain what you need to do: www.a2hosting/kb/installable-applications/optimization-and-configuration/magento1/cron-jobs-do-not-run-on-magento-1-8-after-upgrade

确保您使用的是正确版本的 php

可能只是您使用的是旧版本的 php!默认情况下,在我的情况下,在 1and1 上,只需使用 php 命令即可获得 v4.4.9.我必须明确强制 php v5 然后它才能工作!

It might simply be you're using an old version of php! By default, on 1and1 in my case, just using the php command gets v4.4.9. I have to explicitly force php v5 and then it works!

我还建议安装 Fabrizio Branca 的 AOE 调度器扩展

I'd also recommend installing Fabrizio Branca's AOE Scheduler extension

更多推荐

Magento 定时任务

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

发布评论

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

>www.elefans.com

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