php-windows Digest 5 Jul 2009 04:14:45 -0000 Issue 3655
Topics (messages 29439 through 29442):
Re: Execute shell php scripts (was: Hiiiiii)
29439 by: Sascha Meyer
Re: Can i run php script using command prompt in any location by typing
scriptname.php
29440 by: Walter Torres
29441 by: Richard Quadling
29442 by: Walter Torres
Administrivia:
To subscribe to the digest, e-mail:
[email protected]
To unsubscribe from the digest, e-mail:
[email protected]
To post to the list, e-mail:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
Hi Ravi,
> I want to know that Can i run php script using command prompt in any
> location by typing scriptname.php?
I think that question was answered by Richard, you can have another look it at
through the PHP-WIN user list web frontend:
http://news.php.net/php.windows/29434
Follow his steps and you'll be able to run php files as executable files.
Another way to execute php shell script is setting your PATH environment
variable to point to your php.exe. If set, you can run php files though typing
"php myscriptname.php".
Regards, Sascha
--
Neu: GMX Doppel-FLAT mit Internet-Flatrate + Telefon-Flatrate
für nur 19,99 Euro/mtl.!* http://portal.gmx.net/de/go/dsl02
--- End Message ---
--- Begin Message ---
Quoting Ravi Joshi <[email protected]>:
Hi,
I have downloaded ZendServer-CE-4.0.3-Windows_x86.exe(49.6
MB) and installed it in C:\Program Files\Zend derectory .Whenever i
want to run any php script i have to put my php script in C:\Program
Files\Zend\ZendServer\bin directory and then by the command prompt
first i goto in C:\Program Files\Zend\ZendServer\bin location and
then i type php scriptname.php. after doing this i get the output
from php script.
I want to ask that can i run my php script by simply double
clicking or by command prompt only by typing scriptname.php in any
location.
Yes and no.
No, you can't double click it.
Yes, you can if you set up the proper association with the .php extension.
No, you can't just type the scriptname.php at the command line to run
the script.
Yes, if you have the path to PHP executable in your PATH variable,
then you can type...
> php scriptname.php
Walter--
...that's the thing about people who think they hate computers.
What they really hate is lousy programmers.
- Larry Niven and Jerry Pournelle in "Oath of Fealty"
--- End Message ---
--- Begin Message ---
2009/7/4 Walter Torres <[email protected]>:
> Quoting Ravi Joshi <[email protected]>:
>
>> Hi,
>> I have downloaded ZendServer-CE-4.0.3-Windows_x86.exe(49.6 MB) and
>> installed it in C:\Program Files\Zend derectory .Whenever i want to run any
>> php script i have to put my php script in C:\Program
>> Files\Zend\ZendServer\bin directory and then by the command prompt first i
>> goto in C:\Program Files\Zend\ZendServer\bin location and then i type php
>> scriptname.php. after doing this i get the output from php script.
>> I want to ask that can i run my php script by simply double
>> clicking or by command prompt only by typing scriptname.php in any
>> location.
>
> Yes and no.
>
> No, you can't double click it.
> Yes, you can if you set up the proper association with the .php extension.
>
> No, you can't just type the scriptname.php at the command line to run the
> script.
> Yes, if you have the path to PHP executable in your PATH variable, then you
> can type...
>
> > php scriptname.php
>
> Walter--
> ...that's the thing about people who think they hate computers.
> What they really hate is lousy programmers.
> - Larry Niven and Jerry Pournelle in "Oath of Fealty"
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Walter.
You CAN just double click a PHP script and have it run. Just like you
can double click a BAT and have it run.
You CAN just type the name of a PHP script at the command line
(without the .php extension and without having to type the name of the
executable) and have it run. Just like you can type the name of a BAT
script (without the .bat extension and without having to enter the
name of the executable) and have it run.
In fact, you can have ANY sort of file automatically processed (not
executed, though that is the primary intent of the mechanism that
supports this facility).
The environment variable PATHEXT is the key. [1] and [2] have relevant
information.
Once you've told the OS that a PHP script is to be considered
executable, it is just a case of joining the extension to an
executable. In this case the php-cli.exe for PHP4 and php.exe for
PHP5. Add the location of the executable to the PATH to make things
easier and you're done.
If this setting up process takes more than 2 minutes, then you're
doing it wrong.
No need to reboot, but any open command prompts would need to be
cycled to gain the new environment variable settings.
Regards,
Richard.
[1] http://wiki.tcl.tk/1785
[2] http://en.wikipedia.org/wiki/COM_file#Execution_preference
--
-----
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"
I need a car : http://snipurl.com/l4pih
ZOPA : http://uk.zopa.com/member/RQuadling
--- End Message ---
--- Begin Message ---
Walter.
You CAN just double click a PHP script and have it run. Just like you
can double click a BAT and have it run.
Welp! I'm Wrong again!
Walter
--- End Message ---