Topic: php code via the command line on windows (Read 3765 times)
Global Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6691
34714 credits Members referred : 374
It's time to use PHP5!
« on: Sep 11, 2006, 05:02:24 pm »
Hello,
I need to execute some php code through the command line on windows, like:
from remote a script is executed to post some vars with GET, after these vars are checked this vars need to beused in a scripty which has to be executed throuhj the commanline.
I tried already the dos box and executed this code succesfully: "php myfile.php"
how to do that via a a script?
I tried this code but nothing is happen: exec("php myfile.php");
I executed the script via the browser...
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 5799
46391 credits Members referred : 3
« Reply #1 on: Sep 11, 2006, 05:19:44 pm »
Maybe CURL?
BTW the exec ("php .... wont work because you don't add the path to the php.exe file.
BTW the exec ("php .... wont work because you don't add the path to the php.exe file.
I add the path to the environment, I need to execute a php script (or code) on the command line while on remore a script is called, how to do that with curl?
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 5799
46391 credits Members referred : 3
« Reply #3 on: Sep 12, 2006, 07:49:46 am »
Does this helps? (Still I am not sure what you want to do)
Code:
<?php while ( true ) { //curl the remote script here }
Does this helps? (Still I am not sure what you want to do)
Code:
<?php while ( true ) { //curl the remote script here }
I can't follow you
It looks like that the script must be executed by CLI and not CGI that's why I need this, since there server oinly need to execute one script I shpuld change the config. Is it possible to run php in cli mode and access the scripts via the browser?
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 5799
46391 credits Members referred : 3
My script is working (the thumbnail thing) but in some cases it doesn't work via the regular way, But if I run the script via the command line it works fine. (don't ask me why its just a workarround)
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 5799
46391 credits Members referred : 3
« Reply #7 on: Sep 12, 2006, 08:52:05 am »
Ok, and when do you want to run it from CLI?
I mean this will be triggered from another php script, or it will be croned?
Global Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6691
34714 credits Members referred : 374
It's time to use PHP5!
« Reply #12 on: Sep 12, 2006, 09:13:30 am »
nope doesn't work...
I tried already the system command to echo some text to the browser and this is fine, but executing a complexer script doesn't work
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 5799
46391 credits Members referred : 3
« Reply #13 on: Sep 12, 2006, 09:17:50 am »
Maybe the script is using something that wont work from CLI.
Common problems to this is the include path. Try to use the set_include_path() function in the script that you are executing to assing the correct paths (it wants full paths)
Also check if you are using the $_SERVER variable as this is not working with CLI.