Hello,
I would like to know how to execute a PHP script in commande line, with linux.Thanks in advence for the answer.
[PHP]commande line?
Moderator: General Moderators
-
cheikhbouchihda
- Forum Commoner
- Posts: 51
- Joined: Thu Mar 02, 2006 2:08 pm
- Location: France.
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Code: Select all
php -f filename.php- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
If PHP is not in your PATH variable it's possible the binary sits somewhere like /usr/lib/php/bin/ or such likefeyd wrote:Code: Select all
php -f filename.php
-
cheikhbouchihda
- Forum Commoner
- Posts: 51
- Joined: Thu Mar 02, 2006 2:08 pm
- Location: France.
I've found that "which php" can do miracles 
Usually i use /usr/bin/env as shebang in my shell scripts... Eg:
...
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";...
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia