PDA

View Full Version : PHP from shell



niiize
August 19th, 2009, 06:18 PM
Have apache2 installed but cannot find the right php path, even tho my website works fine with php scripts in it. i need to find out because i want to be able to run scripts from shell #!path/to/php

thank you

Mirge
August 19th, 2009, 06:33 PM
which php

or

whereis php

niiize
August 19th, 2009, 06:44 PM
forgot to mention that i've tried this......... :P

'whereis' only returns
php:
and 'which' return nothing at all

v8YKxgHe
August 19th, 2009, 06:47 PM
You need to use the CLI version of PHP. The version you have installed is most likely a module to Apache2, so there will be no binary you can use like that.

The package is 'php5-cli'.

niiize
August 19th, 2009, 06:50 PM
super. thank you. works fine.

slakkie
August 19th, 2009, 08:19 PM
Btw, #!/usr/bin/env php is something you can use, so when migrating from one system to another you don't need to remember the path to php (although on some systems the path to env is different..).