Windows 计划任务不适用于 PHP 脚本
我每天上午 9 点使用 Windows Server 2003 尝试执行 PHP 脚本。这是运行中的命令:
"C:\Program Files\Zend\ZendServer\bin\php.exe" C:\Program Files\Zend\Apache2\htdocs\signout\teachernotify.php
它应该执行上面的 PHP 脚本应该给我发电子邮件,但它不起作用。通过浏览器访问上面的脚本可以,但不能通过计划任务访问。
当我通过任务计划程序运行它时,它就像发生了什么事一样,但它似乎不起作用。
有什么建议吗?
谢谢
I'm using Windows Server 2003 to try and execute a PHP script every day at 9AM. Here's the command inside of run:
"C:\Program Files\Zend\ZendServer\bin\php.exe" C:\Program Files\Zend\Apache2\htdocs\signout\teachernotify.php
It's supposed to execute the PHP script above which is supposed to e-mail me, but it doesn't work. Accessing the script above through a browser works, but not through Scheduled Tasks.
When I run it through the task scheduler, it goes through like something happened, but it doesn't appear to work.
Any advice?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来可能是权限问题。当通过 Web 浏览器运行 Apache 时,权限将基于 Apache 运行时的任何权限。作为计划任务,权限基于为任务指定的用户。
确保任务设置对话框的“运行身份”字段中指定的用户有权发送电子邮件。
根据您最近的评论,问题似乎是文件名需要用双引号引起来。我在原来的问题中没有注意到这一点。
It sounds like it could be a permissions problem. When run through Apache via a web browser, the permissions would be based on whatever permissions Apache is running under. As a scheduled task, the permissions are based on the user specified for the task.
Make sure that the user specified in the "Run as" field in the task settings dialog has permissions to send an email.
Based on your most recent comment, it seems the problem is that the filename needs double quotes around it. I failed to notice that in the original question.