Hi, Thursday, November 29, 2007, 2:17:15 AM, you wrote: a> Hello! a> I'm trying a lot to find how I can run the cmd (command line of windows) and a> send to the cmd commands? a> Thanks. Here is one way to do it, its from a function to check php syntax. it opens up php then sends it the text to check and reads the answer back. function checkPhpSyntax($text){ $r = false; $cwd = getcwd(); chdir("C:\\php5"); $descriptorspec = array( 0 => array("pipe", "r"), // stdin is a pipe that the child will read from 1 => array("pipe", "w"), 2 => array("file", "C:\\php5\\error.txt", "a")); $process = proc_open("C:\\php5\\php -c C:\\php5 -l", $descriptorspec, $pipes); fwrite($pipes[0], $text); fclose($pipes[0]); $out = ''; while(!feof($pipes[1])) { $out .= fgets($pipes[1], 1024); } fclose($pipes[1]); proc_close($process); chdir($cwd); if(!empty($out)){ $res = split("\n",$out); if(preg_match('/No syntax errors/',$res[0])){ $r =true; }else{ $error = $res[1]; if(preg_match('/Parse error:/',$error)){ $match = preg_split('/line/',$error); $line = intval(trim($match[1])); //show error here } } } return $r; } -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php