Hi, Shawn and all: I tried to run the script using the method you suggested for Windows, but it gives me this:
'http' is not recognized as an internal or external command, operable program or batch file. I could telnet and ping to the server using #80 to where the script calculate.php is located, though. Do you or anyone else on the list might tell me why I cannot execute the script through this method? Here is my calculate.php, if it is of any help to you for troubleshooting: <?php // For PHP 5 and up $file="http://www.mysite.com/lung.txt"; $handle = fopen("lung.txt", "rb"); $contents = stream_get_contents($handle); fclose($handle); $count = count(explode(" ", $contents)); echo "<p>There are <b>" . $count. "</b> words in <b>" . $file . "</b></p>"; ?> Thanks in advance. Alice ====================================================== Alice Wei MIS 2009 School of Library and Information Science Indiana University Bloomington [EMAIL PROTECTED] ________________________________________ From: Shawn McKenzie [EMAIL PROTECTED] Sent: Tuesday, June 24, 2008 10:43 PM To: php-general@lists.php.net Subject: [PHP] Re: exec() Error Wei, Alice J. wrote: > Hi, > > I have got a task from my client asking me to build something that > allows the variables in the PHP file passed to another PHP file or a file in > a different computer language to perform some operations on another remote > machine. According to my client, he calls this behind the scenes to avoid > users screw up the front end, and I am hoping that I can produce one single > script, and have it execute some script without the user pushing any button. > Has anyone tried using exec() successfully in PHP to execute files from PHP > or other programming languages? For example, C, Python, or Perl. > > I have tried this by putting in > > exec("http://www.mysite.com/calculate.php"); > > This is the error I got: > > Warning: exec() [function.exec]: Unable to fork > [http://www.mysite.com/calculate.php] in C:\Inetpub\wwwroot\read.php on line > 31 > > I have checked my permissions, and I have set it to 755. > Does anyone know how I might be able to correct this error? > > Thanks in advance. > > Alice > ====================================================== > Alice Wei > MIS 2009 > School of Library and Information Science > Indiana University Bloomington > [EMAIL PROTECTED] Well, whatever OS you use, try typing that at the command line and see if it works. That's what exec does in effect. Linux: $ http://www.mysite.com/calculate.php Windows: C:\> http://www.mysite.com/calculate.php -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php