Reputation: 7299
After hours and hours of trying and searching for an answer i coudn't get it working.
Hosting details:
Windows Server 2012 R2
Plesk 12
IIS 8.5
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
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;
Output:
Array ( )
0
$command = '"C:\\Program Files (x86)\\FileZilla Server\\FileZilla Server.exe" /reload-config';
system( $command, $output);
print_r($output);
Output: 0
$command = 'C:\\"Program Files (x86)\\FileZilla Server\\FileZilla Server.exe" /reload-config';
exec( $command, $output, $return);
print_r($output);
echo '<br/>' .$return;
Output: 0
exec( 'C:\\"Program Files (x86)\\FileZilla Server\\FileZilla Server.exe" /stop 2>&1', $output);
print_r($output);
Output:
Array ( [0] => Toegang geweigerd. )
In english:
Array ( [0] => Access denied. )
In allmost all awnsers found they talked about privileges. I did following privileges:
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
Somebody said to try this:
echo '<pre>';
system('set', $retval);
echo ' </pre>';
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.
If you have done all of this, it now should work.
Upvotes: 0
Views: 6121
Reputation: 7299
If you have done all of this, it now should work.
Upvotes: 1
Reputation: 926
Note: If current has high privileges over system, This will be high risk.
Upvotes: 0
Reputation: 83
There is a much safer way to do this I figured out by using the above and exploring some. All you need to do is enable "Load User Profile" and it will then have all the normal user permissions assigned by a regular user. Just got it working like this instead of giving administrative access:
and working! specifically fixed Windows 2012 R2
Upvotes: 0