Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Windows Server 2003 x64

PHP 5.2

IIS 6.0

The program Ink2Png.exe is set with Everyone->Read and Execute permissions.

As does its dependency (microsoft.ink.dll)

PHP Safe Mode is off

exec() is passed [the full exe path], space, [full path to another file]

This other file also has full read permissions.

The output directory has full write permissions.

As soon as exec() is hit, the connection dies, the browser does not even receive a full set of http headers, and it reports a CGI error. Examining the output, it appears the program was not even run.

Any ideas? How can I figure out what exactly is happening and get it running again?

EDIT: Also, it is a .NET application, if that is significant in any way.

share|improve this question

3 Answers 3

@Patrick: If you've only given the user Everyone access, then you'll need to add read/execute permissions for IUSR_<MachineName> and IWAM_<MachineName> as well and IIS_WPG too if you're still having issues. Remember to give Write access for all those users for your output directory as well.

share|improve this answer
    
Well the IUSR was already there, and the only IWAM_ ones were _plesk(default) and _TEMPLATE, so I added them and the WPG just for good measure. No dice. –  Patrick Mar 22 '11 at 23:47

What status code is stored in the IIS logs for such an attempt?

Could it be the Web Service Extension list preventing execution? (would have thought it unlikely, would have only expected a single level of executable blocking, but there ya go)

share|improve this answer
    
This is the log line: 2011-05-30 17:14:44 W3SVC11083 CT3462 66.197.54.226 GET /mobile/beta/patients/view.php id=4 80 - 142.166.62.168 HTTP/1.1 Mozilla/5.0+(Windows+NT+6.0;+WOW64)+AppleWebKit/534.24+(KHTML,+like+Gecko)+Chrom‌​e/11.0.696.68+Safari/534.24 mem_user=<redacted>;+mem_pass=<redacted>;+PHPSESSID=<redacted> http://<domain>/mobile/beta/patients/list.php <domain> 502 2 2147500037 417 645 1500 –  Patrick May 30 '11 at 17:24
    
502 is a Bad Gateway error, not sure what the substatus code 2 is, and the win32 error code translates to 0x80004005 -> access denied. If this si still in beta, I'd suggest a) firewalling the box so nothing else can get to it, b) turning off the ISAPI and CGI restrictions just to doublecheck it's not preventing them from running. Also, if you're using PHP, how is it a .Net application? What's the relationship there? Could it be .Net CAS policy preventing you from running arbitrary EXEs? Think you may need to talk to Microsoft support to nut this one out, loads more detail needed. –  TristanK May 31 '11 at 1:57
    
The exe that PHP uses exec on is the .NET application. Pass it a .isf and it spits out a .png. The active version relies on a quick-and-dirty windows service that monitors the folder for any new .isf files and converts them automatically, but that still leaves the chance that it could miss one before the request for the .png comes in. The PHP user has full access to execute that file, I even went as far as letting everyone run it, and still nothing. –  Patrick May 31 '11 at 12:36
    
Also, the exe is signed and works under cmd without PHP. So it's access denied to something, but it's not telling me what or where or why. –  Patrick May 31 '11 at 13:11

To execute a .exe file with PHP, you'll need execute permissions on cmd.exe for the IUSR_account. Obviously this is a very bad idea.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.