Run PHP w/o Webserver

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
phirez
-


Joined: 22 Apr 2006
Posts: 57

PostPosted: Fri Sep 08, 2006 4:03 am    Post subject: Run PHP w/o Webserver Reply with quote

I know you can run a php script with this code:
Code:
php.exe C:\path to\script.php
But can I do this for entire folders. ie.
Code:
php.exe C:\path to folder
I tried this and it did not work so is there another command.
Back to top View user's profile Send private message
Tim1681
-


Joined: 17 Jan 2005
Posts: 160
Location: Bristol, CT, USA

PostPosted: Fri Sep 08, 2006 4:36 am    Post subject: Reply with quote

Why would you want to execute a whole entire directory?
_________________
mysql> SELECT * FROM users WHERE clue > 0;
0 rows returned.

Back to top View user's profile Send private message AIM Address
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Fri Sep 08, 2006 8:22 am    Post subject: Reply with quote

This is not possibe. You can use some of the built in functions from PHP to read
a folder of files. Is this what you want?

http://www.php.net/readdir
Back to top View user's profile Send private message Visit poster's website
cmxflash
-


Joined: 11 Dec 2004
Posts: 872

PostPosted: Fri Sep 08, 2006 11:35 am    Post subject: Reply with quote

Use this script to execute all files in a folder. Didn't test it, should work however.

Code:
<?php
if ($handle = opendir('/some-dir')) {
   while (false !== ($file = readdir($handle))) {
       echo "\nRunning file: $file...\n";
       include("/some-dir/".$file);
   }
   closedir($handle);
}
?>
Back to top View user's profile Send private message
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Fri Sep 08, 2006 1:32 pm    Post subject: Re: Run PHP w/o Webserver Reply with quote

phirez,

An easier way is to use the DOS shell commands as in:

Code:
for %f in (C:\pathto\*.php) do php.exe %f

_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
phirez
-


Joined: 22 Apr 2006
Posts: 57

PostPosted: Sat Sep 09, 2006 2:28 am    Post subject: Reply with quote

Thank's for the help!
Back to top View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group