Re: Exec()
| From: | Patrick | Date: | Thu, 12 Apr 2001 09:20:30 +0000 |
| Subject: | Re: Exec() | ||
| References: | 1 2 3 4 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-6665@lists.php.net to get a copy of this message | ||
""Helmut Himmelstoss"" <Helmut.Himmelstoss@t-online.de> wrote in message
news:9b21na$iu7$1@toye.p.sourceforge.net...
> I copied the Program Ping.exe to the same directory as my script and the
> User the IUSR_[Machine name] hast the permissions.
>
> <?php
> echo"<pre>";
> $dd=system("ping ping 127.0.0.1");
> echo "$dd ;;this is a system-test";
> echo "<hr>";
> ?>
> The result is the same.......... no result:
> ;;this is a system-test
>
you must use single quotes in system() call
ping ping whats that check your erorr logs
this worked for me
<?
//escaping the backslash and in single quotes
//this works for win98/apache/php4apache.dll
//NOTE: this and the php4isapi.dll is not yet ready
//for production, if CGI MODE then I do think it should work
echo"<pre>";
$dd=system('c:\\windows\\ping 127.0.0.1');
echo "$dd ;;this is a test";
echo"</pre>";
?>
printed this out
Pinging 127.0.0.1 with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time=1ms TTL=128
Reply from 127.0.0.1: bytes=32 time=1ms TTL=128
Reply from 127.0.0.1: bytes=32 time=1ms TTL=128
Reply from 127.0.0.1: bytes=32 time=1ms TTL=128
Ping statistics for 127.0.0.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 1ms, Average = 1ms
Minimum = 1ms, Maximum = 1ms, Average = 1ms ;;this is a test