Page 1 of 1

How to USE php CLI

Posted: Fri Apr 17, 2009 9:34 am
by pallavan
hi friends,
I wanna use the php CLI on my local server.
when I use
-bash:$ php filename.php

it returns like
-bash: php: command not found

but when i give like
/opt/lampp/bin/php filename.php

then it is being executed perfectly!

how can I configure it so that I can run using the former command
ie
php filename
For you information:
my local servers OS :-> federo
and lampp installed.

Thanks

Re: How to USE php CLI

Posted: Fri Apr 17, 2009 10:24 am
by pickle
The command 'php' needs to be in your 'search path' (or something similarly named). When you log in to a Linux box, the shell reads some ini files to determine what your search paths are. When you type in a command, Linux looks through all your search paths to find an equivalent executable file. If it finds one, it runs it. If not, it gives you the error you see.

I'm not exactly sure how to put 'php' in your search path, but now that you know what's happening, Google should be able to help.

Also, I'm moving this to the 'Linux' forum.