I've installed PHP with the Apache module and it's working fine. I can do all sorts of whiz-bang stuff, create all the "Hello World" conditional pages you could imagine. However, there's something I've been beating my head against the wall about: I need to call a command-line program from a PHP page. It's just that simple. I can't get anything to work, even a simple directory listing. I've tried using both System() and Exec() and it always fails. I get an "Unable to Fork [foo.exe]" message each and every time. I've tried every possible variation and cannot get it to work: please help?
My syntax:
<?php
Exec("dir /D");
?>
OR
<?php
Exec("cmd dir /D");
?>
My syntax:
<?php
System("dir /D");
?>
OR
<?php
System("cmd dir /D");
?>
I'm sure I'm blowing something from a syntax standpoint, so any clue someone could give me would be grand. Thanks for your help: my configuration info follows.
Configuration:
- Windows NT 4.0 / SP 6
- Apache 1.3.14
- PHP 4.0.4pl1
- php4_module
- Apache Root is D:\Apache
- PHP Root is D:\PHP
From my httpd.conf:
LoadModule php4_module D:/php/sapi/php4apache.dll
AddType application/x-httpd-php .php
From my php.ini (At C:\winnt):
extension_dir = D:\php\extensions\
P.S. I've seen about 7000 posts on this subject, and have tried all of the answers people give. I'm not posting this to simply be a pest and throw another one on the pile.