PHP exec()命令不起作用 [英] PHP exec() command not working

查看:462
本文介绍了PHP exec()命令不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

经过数小时和数小时的尝试并寻找答案我无法让它发挥作用。

After hours and hours of trying and searching for an answer i coudn't get it working.

托管详情:

Windows Server 2012 R2

Windows Server 2012 R2

Plesk 12

IIS 8.5

我的问题是:
我想在PHP中执行此命令。在使用PHP脚本创建新用户之后,必须使用该命令重新加载filezilla的配置。

My problem is: I want to execute this command in PHP. The command is necessary to reload the configs for filezilla, after creating a new user with an PHP script.

C:\Program Files (x86)\FileZilla Server\FileZilla Server.exe /reload-config

它确实有效当我直接在CMD中尝试它。
但是在PHP中如果不能以某种方式工作。我尝试了很多东西,我试图给你所有尝试的方式。

It does work when i try it directly in CMD. But in PHP if doens't somehow work. I tried so many things, that im going to try to give you all the manners i tried.

我试着通过以下方式做到这一点:

I tried to do this at the following ways:

$command = '"C:\\Program Files (x86)\\FileZilla Server\\FileZilla Server.exe" /reload-config'; 
exec( $command, $output, $return); 

print_r($output);
echo '<br/>' .$return;

输出:

Array ( ) 
0



试用2



Trial 2

$command = '"C:\\Program Files (x86)\\FileZilla Server\\FileZilla Server.exe" /reload-config'; 
system( $command, $output); 

print_r($output);

输出: 0

$command = 'C:\\"Program Files (x86)\\FileZilla Server\\FileZilla Server.exe" /reload-config'; 
exec( $command, $output, $return); 

print_r($output);
echo '<br/>' .$return;

输出: 0

exec( 'C:\\"Program Files (x86)\\FileZilla Server\\FileZilla Server.exe" /stop 2>&1', $output); 
print_r($output);

输出:

Array ( [0] => Toegang geweigerd. )

英文:

Array ( [0] => Access denied. )



特权:



在所有的发现者中,他们都发现了特权。我做了以下权限:

Privileges:

In allmost all awnsers found they talked about privileges. I did following privileges:

将所有Web用户和IUSR权限授予CMD.exe和FileZilla Server.exe,
并尝试从匿名设置IIS身份验证管理员帐户

Gave all web users and IUSR privileges to CMD.exe and FileZilla Server.exe, and tried to set the IIS authentication from anonymous to an Administrator account

有人说试试这个:

echo '<pre>';
    system('set', $retval);
echo ' </pre>'; 

如果我这样做,我的输出是: http://pastebin.com/SjzeQpJ0

If i do that my output is: http://pastebin.com/SjzeQpJ0

如果你们想要了解更多细节,请询问。我希望你们能为我解决这个问题。我试图尽可能清楚。谢谢。

If you guys want anymore details just ask. I hope you guys can figure it out for me. I tried to be as clear as possible. Thanks.

最终找到解决方案!!



如果你遇到和我一样的问题,那么你不知道如何解决这个问题,请按照以下步骤操作。

Finaly found the solution!!


If you encounter the same problem as i did, and you dont know how to fix this, follow this steps.


  1. 登录服务器的Remote(如果可以访问它)打开

  2. 打开IIS管理器

  3. 选择 - >机器节点下的应用程序池节点(左侧面板)

  4. 右键单击所需的域名 - >高级设置

  5. 滚动到流程模型 - > Id

  6. 点击3点

  7. 检查自定义帐户单选按钮

  8. 填写现有的管理帐户,该帐户可以访问
    远程桌面,当然还有密码

  9. 按OK

  10. 现在转到.exe或您要通过
    exec命令访问的任何文件和

  11. 右键单击文件并选择属性

  12. 转到安全选项卡

  13. 选择编辑

  14. 现在满满的您之前选择的帐户的权利。如果未列出
    ,请单击添加

  1. Login to the Remote of your server (if you have access to it) Open
  2. Open the IIS manager
  3. Select -> Application Pools node underneath the machine node (left panel)
  4. Right click on the desired domainname -> Advanced settings
  5. Scroll to Process Model -> Id
  6. Click on the 3 dots
  7. Check the Custom Account radio button
  8. Fill in an existing administration account which has access to the remote desktop and of course its password
  9. Press OK
  10. Now go to the .exe or whatever file you want to access throught the exec command and
  11. Right click on the file and select properties
  12. Go to the security tab
  13. Select Edit
  14. Now grand full rights to the account you selected before. If its not listed than add it manualy by clicking on Add

如果您已完成所有这些,它现在应该可以工作。

推荐答案

最终找到解决方案!!



如果您遇到与我相同的问题,并且您不知道如何解决此问题,请按照以下步骤操作。

Finaly found the solution!!


If you encounter the same problem as i did, and you dont know how to fix this, follow this steps.


  1. 登录到服务器的远程(如果您有权访问它)

  2. 打开IIS管理器

  3. 选择 - >应用程序池节点下面的机器节点(左侧面板)

  4. 右键单击所需的域名 - >高级设置

  5. 滚动到流程模型 - > Id

  6. 点击3个点

  7. 检查自定义帐户单选按钮

  8. 填写可访问$的现有管理帐户b $ b远程桌面,当然还有密码

  9. 按OK

  10. 现在转到.exe或您要通过$访问的任何文件b $ b exec命令和

  11. 右键单击文件并选择属性

  12. 转到安全选项卡

  13. 选择编辑

  14. 现在对您之前选择的帐户拥有全部权限。如果未列出
    ,请单击添加

  1. Login to the Remote of your server (if you have access to it)
  2. Open the IIS manager
  3. Select -> Application Pools node underneath the machine node (left panel)
  4. Right click on the desired domainname -> Advanced settings
  5. Scroll to Process Model -> Id
  6. Click on the 3 dots
  7. Check the Custom Account radio button
  8. Fill in an existing administration account which has access to the remote desktop and of course its password
  9. Press OK
  10. Now go to the .exe or whatever file you want to access throught the exec command and
  11. Right click on the file and select properties
  12. Go to the security tab
  13. Select Edit
  14. Now grand full rights to the account you selected before. If its not listed than add it manualy by clicking on Add

如果您已完成所有这些,它现在应该有效。

这篇关于PHP exec()命令不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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