在Windows服务器/ Plesk上运行计划任务

时间:2012-08-21 11:52:10

标签: cpanel

尝试将远程php文件作为计划任务运行但遇到PHP错误。

  

错误是“无法打开输入文件:   http://www.example.com/example.php

尝试用各种格式写它:

"C:\Program Files (x86)\Parallels\Plesk\Additional\PleskPHP5\php.exe" -f http://www.example.com/example.php
"C:\Program Files (x86)\Parallels\Plesk\Additional\PleskPHP5\php.exe" -f http://www.example.com/example.php

也尝试没有-f参数,但都导致相同的错误消息

在运行本地域php文件时它确实有效:

"C:\Program Files (x86)\Parallels\Plesk\Additional\PleskPHP5\php.exe" -f "C:\inetpub\vhosts\example.com\httpdocs\example.php"

2 个答案:

答案 0 :(得分:1)

如何在plesk控制面板中创建删除计划任务

http://www.motherhost.in/members/knowledgebase/4/creating-or-removing-scheduled-tasks-in-plesk.html

在Plesk中创建或删除计划任务

Windows servers上,您可以通过创建计划任务(类似于在Linux服务器上运行cron作业的方式)将它们设置为在特定时间运行。 在Plesk 10中创建计划任务:

您可以通过执行以下操作在Plesk中设置预定任务:

Log into Plesk*
Click on the Websites & Domains tab.
Click on Show Advanced Operations (a small grey link in the middle of the page), if the advanced options are not already shown.
Click on Scheduled Tasks.
Select the appropriate system user.
Click on Schedule New Task.
Fill out the form as follows:
    Switched On:  Check the box to turn on the scheduled task.
    Description:  A short description to remind you what this scheduled task does.
    Scheduler Notification:  If you want an email every time this runs, select the appropriate option, otherwise select Do Not Send.  You may provide an email address where you want the notifications sent to.
    Path to executable file:  Specify the path to the file you wish to execute.  For Windows servers, it would be something like this:
    C:\Program Files (x86)\Parallels\Plesk\Additional\PleskPHP5\php-cgi.exe
    Arguments: D:\Inetpub\vhosts\mydomain.tld\httpdocs\myscript.php
    For Linux servers with Plesk, ir would be something like this:
    /var/www/vhosts/domain.tld/httpdocs/myscript.php
    Replace domain.tld with your domain name, and myscript.php with the appropriate subfolder(s) (if any) and filename.
    Task Priority:  Select Low, Normal or High.
    Specify when to run your command by selecting the appropriate checkboxes in the Hours, Days of month, Months or Days of week fields.
    Click OK to schedule the task or click Run Now to schedule the task and immediately run it.
You will be taken back to the Scheduled Tasks screen and you should see your new scheduled task listed at the bottom.

删除Plesk 10中的预定任务

Logging into Plesk*
Click on the Websites & Domains tab.
Click on Show Advanced Operations (a small grey link in the middle of the page), if the advanced options are not already shown.
Click on Scheduled Tasks.
Select the appropriate system user.
Check the box next to the Scheduled Task you want to remove.
Click on the Remove button.
It will load a new page and ask if you really want to deleted it.  Check the Confirm Removal box and click on the OK button.
You will be taken back to the Scheduled Tasks screen and it should say: "Information: Scheduled tasks were removed."

web hosting india& reseller hosting india

答案 1 :(得分:0)

PHP命令行执行仅支持本地文件。如果要获取远程PHP脚本输出,则可以使用wget。

注意:确保Windows服务器上安装了wget.exe。请联系您的托管服务提供商以获取路径。

c:\....path to wget...\wget.exe http://www.example.com/example.php
相关问题