Simple system call in PHP dosn't work on Windows Box???

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bradsteele
Forum Newbie
Posts: 15
Joined: Fri Jun 17, 2005 10:27 am

Simple system call in PHP dosn't work on Windows Box???

Post by bradsteele »

I have the following simple code and it dosn't work on a WIN2003 server, but it does work on a linux box??? Any ideas???
I am just trying to list the contents of the current directory, where the script resides?? Can't seem to figure out why it won't execute my shell command?

Code: Select all

<html>
<head>
<title>Untitled</title>
</head>
<body>

<?php
echo '<pre>';
$last_line = system("dir *.*", $retval);
echo '
</pre>
<hr />Last line of the output: ' . $last_line . '
<hr />Return value: ' . $retval;
?> 
</body></html>
Any help anyone can give me would be greatly appreciated.

Thanks,

Brad
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Re: Simple system call in PHP dosn't work on Windows Box???

Post by Roja »

bradsteele wrote:I have the following simple code and it dosn't work on a WIN2003 server, but it does work on a linux box??? Any ideas???
Click the linked "System" function from your code: http://us2.php.net/system

Read the user comments about permissions on IIS and Windows. System and Windows is *extremely* difficult to get working correctly.
Post Reply