English 中文(简体)
• 如何使用PHP在Windows服务器上安装自动HotKey文字?
原标题:How to use PHP to execute AutoHotKey script on Windows Server 2016?

我有一台Windows服务器2016 VPS,有Plesk和PHP 7.1x。

我正试图使用以下指挥从PHP处执行简单的自动直升机:

<?php shell_exec( start /B "C:Program FilesAutoHotkeyAutoHotkey.exe" C:inetpubvhostsmydomain.comApp_Datamyahkscript.ahk ); ?>

这是该网页上唯一的一线。 我尝试了不同的手稿,目前的手稿只是制造了一个 Ms子。

在我执行我的营地网页时,我看到与预期的苏联共同创建的三个进程:厘米度、相邻、顶和php-cgi.exe。 然而,我的PHP页面只是坐在服务器上,实际上服务器上没有发生。

我也尝试了同一条线,但用外壳取代炮弹。 这似乎没有改变。 我在两条指挥下尝试了没有<密码>的开端/b。 在此情况下,PHP网页已经完工,但没有启动新的程序。

在任何记录中,我找不到任何错误:Mod_security,Plesk 防火墙,IIS。

任何想法?

EDIT: I tried my command from the VPS command prompt and immediately slapped in the face with the obvious issue of the space in Program Files . I quoted the string as shown above and the command works. This eliminated the hang when running from PHP. However, the command still does nothing when executed from the web page.

EDIT: Based on suggestions from the referenced post debugging exec() :

var_dump: string(0)""
$output: Array()
$return_val: 1

一点是,我可能无法援引全球倡议的申请。 这使这一想法变得.。

问题回答

在任务中设定<代码>command1。

<编码> SCHTASKS /F /Create /TNtor1 /TR “D:Program filesAutoHotkeyAutoHotkey.exe”“D:xampphtdocscmd.ahk” /SC 00:00

书写Hk指挥部cmd.ahk

<?php
$command =   ;
$command .=  run, C:\Windows\SysWOW64\calc.exe .PHP_EOL;
$command .=  msgbox, opened calulator .PHP_EOL;

$fp = fopen( cmd.ahk ,  w+ );
$content = $command.  ;
fwrite($fp, $content);
fclose($fp);

$exec =  schtasks /run /tn "command1" ;
exec($exec);

页: 1

<代码> Localhost/test.php





相关问题
Session Management with Windows Authentication

In an ASP.NET web app, using Integrated Windows Authentication, is the session tied to the windows identity? In other words, if I login (using IWA) to the app, and the app stores some "stuff" in my ...

Using Elmah with Cassini

Does anyone know if I can use Elmah with Visual Studio build-in web server(aka Cassini)? I get it working easily on IIS, but using same configuration, it doesn t work with Cassini. When I requested ...

Setting hostname in IIS, include www?

I want to set the hostname for a website I m adding in IIS 7, however do I include the www in the hostname or not? because I want both www.mysite.com and mysite.com both to point to mysite on the ...

inetpub versus any other folder

I ve run websites out of inetpub, as well as from folders just residing on the C: drive. I wonder, are there any definitive advantages to running websites out of inetputwwwroot?

IIS 6.0 hangs when serving a web-service

I am having issues with one of our web-services. It works fine on my development machine (win XP) whether I host it as a separate application or using cassini from Visual studio. Once I deploy on the ...

热门标签