apache 服务 php exec 不工作 [英] apache service php exec not working

查看:19
本文介绍了apache 服务 php exec 不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我查了所有其他关于此的问题,但没有帮助,所以:

I looked up all other questions regarding this, but they didn't help, so:

我在域内的 Windows Server 2003 机器上运行 xampp(lite),apache 作为服务安装.问题是:php函数exec、system、passthru等什么都不做,没有错误信息(apache的日志级别是debug,php error_reporting是E_ALL),没有程序执行,什么都没有,就好像函数调用不是'在那里

I'm running xampp(lite) on a Windows Server 2003 machine inside a domain, apache is installed as a service. The problem is: the PHP functions exec, system, passthru, etc. do nothing, no error messages (log level of apache is debug, php error_reporting is E_ALL), no program execution, nothing, it acts as if the function call wasn't there

我尝试了不同的方法:exec, system, ..;proc_openWScript.Shell COM 对象,没有任何效果.我尝试使用绝对路径,向用户授予权限,尝试了大量不同的 .exe 执行不同的操作,但没有任何效果,也没有执行任何操作.

I tried different approaches: exec, system, ..; proc_open and the WScript.Shell COM object, nothing worked. I tried using the absolute path, gave permissions to the user, tried tons of different .exe's doing different stuff, nothing worked, nothing every was executed.

我给了 Apache 服务我的用户名;给它自己的apache用户;给它系统用户并勾选允许与桌面交互".

I gave the Apache service my username; gave it its own apache user; gave it the system user and ticked "Allow interaction with desktop".

php safe_mode 关闭,也没有禁用任何功能.

php safe_mode is off, also no functions are disabled.

当 apache 不作为服务运行时,一切正常.

When running apache NOT as as service, everything works perfectly.

知道哪里出了问题吗?

TIA

推荐答案

如果您尝试从 Vista 中的服务启动 GUI 应用程序,您会遇到很多麻烦.作为一项安全功能,Vista 使用交互式服务检测"调解服务与桌面的交互.

If you try to launch GUI apps from a service in Vista, you'll have lots of trouble. As a security feature, Vista mediates the interaction of services with the desktop using 'Interactive Services Detection'.

这意味着,如果您将 PHP 作为 Apache 服务的模块运行,您将无法使用任何方法启动 GUI 应用程序.这种事情是行不通的:

That means, if you are running PHP as a module of an Apache service, you won't be able to launch GUI apps using any method. This kind of thing just won't work:

$WshShell = new COM("WScript.Shell");$oExec = $WshShell->Run("notepad.exe", 7, false);

$WshShell = new COM("WScript.Shell"); $oExec = $WshShell->Run("notepad.exe", 7, false);

因此,如果您想使用 Apache/PHP 作为启动 GUI 应用程序的代理,您需要将 Apache 作为控制台应用程序运行.

So, if you want to use Apache/PHP as a proxy for launching GUI apps, you'll need to run Apache as a console application.

首先,如果 Apache 已经作为服务安装,您需要使用服务管理单元将其启动类型设置为手动".(%SystemRoot%\system32\services.msc) 在开始菜单搜索框中搜索服务.

First, if Apache is already installed as a service, you'll need to set it's startup type to "manual" using the services snap-in. (%SystemRoot%\system32\services.msc) Search for Services in the start menu search box.

然后将 C:\apache\bin\httpd.exe(或安装 Apache 的任何地方)的快捷方式添加到您的启动文件夹,并将该快捷方式设置为最小化启动.您可以使用像 TrayIt 这样的应用程序!强制 Apache 进入系统托盘.

Then add a shortcut to C:\apache\bin\httpd.exe (or wherever Apache is installed) to your Startup folder, and set that shortcut to start minimized. You can use an app like TrayIt! to force Apache down into the system tray.

然后使用 PHP 网站上列出的任何方法,您将能够从 PHP 打开 Windows 应用程序并查看它的 GUI.

Then use any of the methods outlined on the PHP website and you will be able to open a Windows application from PHP and see it's GUI.

这篇关于apache 服务 php exec 不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆