Page 1 of 1

[PHP]commande line?

Posted: Sun Mar 12, 2006 12:57 pm
by cheikhbouchihda
Hello,
I would like to know how to execute a PHP script in commande line, with linux.Thanks in advence for the answer.

Posted: Sun Mar 12, 2006 1:03 pm
by feyd

Code: Select all

php -f filename.php

Posted: Sun Mar 12, 2006 6:16 pm
by Chris Corbyn
feyd wrote:

Code: Select all

php -f filename.php
If PHP is not in your PATH variable it's possible the binary sits somewhere like /usr/lib/php/bin/ or such like ;)

Posted: Sun Mar 12, 2006 10:21 pm
by cheikhbouchihda
Thank you very much :)

Posted: Mon Mar 13, 2006 2:07 pm
by timvw
I've found that "which php" can do miracles ;)

Usually i use /usr/bin/env as shebang in my shell scripts... Eg:

Code: Select all

#!/usr/bin/env php
<?php .... ?>

Code: Select all

#!/usr/bin/env perl
print "hello";


...

Posted: Mon Mar 13, 2006 3:13 pm
by feyd
"And shebangs, shebangs
Oh baby
When she moves, she moves
I go crazy..."

:lol: couldn't help myself today.

Posted: Mon Mar 13, 2006 4:54 pm
by Chris Corbyn
feyd wrote:"And shebangs, shebangs
Oh baby
When she moves, she moves
I go crazy..."

:lol: couldn't help myself today.
8O Oh dear....