Executing Shell Scripts in PHP
| From: | Wei, Alice J. | Date: | Tue, 01 Jul 2008 14:53:16 +0000 |
| Subject: | Executing Shell Scripts in PHP | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-28989@lists.php.net to get a copy of this message | ||
Hi,
I am wondering if anyone on this list has made attempts of executing shell scripts using PHP.
Here is the code:
<?php
$command = "gcc -o hello.c";
exec($command);
?>
So far, the actual program is something simple that prints out Hello, World. I have tried using
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://localhost/hello.c");
curl_setopt($ch, CURLOPT_HEADER, false);
All I got is the actual code content that is in one single long string. As for using the PHP snippet
I have at the beginning of the email, all I get is a blank page, although it does not give me errors
of the actual PHP program. Could anyone please tell me what problem I might be having here?
Anything is appreciated.
Alice
======================================================
Alice Wei
MIS 2009
School of Library and Information Science
Indiana University Bloomington
ajwei@indiana.edu