Home > Backend Development > PHP Tutorial > 计划任务执行PHP脚本

计划任务执行PHP脚本

WBOY
Release: 2016-06-23 14:04:12
Original
1024 people have browsed it

项目里有个发邮件的脚本,需要每隔两分钟去数据库读取没有发送的邮件,然后发送出去。我在浏览器中运行没有问题。但因为需要一直运行,就想用windows的计划任务来定时执行。
bat文件是这么写的:

D:\wamp\bin\php\php5.4.3\php.exe -q D:\wamp\www\cron\mailqueue-2min.php

但执行的话,总是发送失败。
请教一下这是哪的问题。 难道php.exe执行和浏览器运行有什么区别?


回复讨论(解决方案)

参数应该用 -f 吧

D:\wamp\www\cron\mailqueue-2min.php  里面如果有reqiure或者include的请用绝对地址,就是这个问题!

D:\wamp\bin\php\php5.4.3\php.exe D:\wamp\www\cron\mailqueue-2min.php
把中间的-q去掉看看

问题解决了 不是参数的问题 是配置文件的问题 我用的wamp环境 有两个ini文件 两个文件里面的配置都得改

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template