Solved

Process started by exec() function appears to hang; script times out.

Posted on 2008-10-06
2
1,141 Views
Last Modified: 2013-12-20
I have two computers both exactly the same (supposedly):

Both are:
Windows Vista Home Premium SP1 32-bit
IIS 7 installed
PHP 5.2.6 installed via FastCGI

Both have a small VB6 program with a registered OCX file it requires to function.  The program does one small operation and immediately terminates itself.

So on one computer I do exec("theProgram.exe"); and it launches, does it's thing, and terminates, as expected.  Task Manager shows that user NETWORK SERVICE launches this process.

On the other computer, the very same PHP operation launches theProgram.exe and it appears in Task Manager, along with cmd.exe, both run by NETWORK SERVICE, and nothing happens.  theProgram.exe does NOT do the operation it was programmed to do and does not terminate itself.  If I load the script from a web browser there is a timeout that shows IIS didn't receive a FastCGI reply.  If I terminate the process for theProgram.exe, then the rest of the PHP script runs normally....   Manually double-clicking on theProgram.exe, verifies that it works fine by doing its function and self-terminating.  Running "php.exe myscript.php" from a Command Prompt, that contains the very same exec() function, runs theProgram.exe just fine and it terminates itself as expected.  This led me to think it's an IIS/PHP configuration problem, or something with the NETWORK SERVICE user credentials.

I exported the configuration for IIS from the computer where everything works as expected, and replaced the one on the problematic computer.  I also replaced the php.ini.  I also verified and re-applied all permissions on files and folders.  Nothing helped.

I've even uninstalled and reinstalled both IIS and PHP.  The problem persists...

Some things seem to work fine on the problematic computer, like if I do echo shell_exec("help"); then it launches cmd.exe HELP under NETWORK SERVICE and the PHP script prints out the response from the HELP command.  I'm just not too sure about it running Win32 programs properly.  I'm now thinking it's some sort of VB6 dependency problem... (???)
0
Comment
Question by:AdiF
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 2

Author Comment

by:AdiF
ID: 22656471
I just tried running a .bat file to launch the .exe instead, to no avail..... How frustrating... hehe.... I'll have to seek out the advice of a Microsoft MVP somewhere.....
0
 
LVL 2

Accepted Solution

by:
AdiF earned 0 total points
ID: 22656537
Resolved:  On one computer (where it's all working fine) i had the OCX dependency registered from within inetpub\wwwroot while on the other it was located in WINDOWS\system32 and registered there.  i have added NETWORK SERVICE permissions to it but it still didn't work.  i unregistered it and deleted it from system32, then registered it from within wwwroot, and now it works..........


......... *sigh*..........
0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question