3

I am in need of using PHP from the command line. When I type

php ....

The system says:

-bash: php: command not found

Now, I know for fact that PHP is up and running b/c it hosts my drupal site. I'm not sure how to find the program. I'm searching through the directories for the path without any success.

What am I missing?

I am using Ubuntu Linux.

I have the following packages installed:

php5                                            install
php5-common                                     install
php5-curl                                       install
php5-gd                                         install
php5-mcrypt                                     install
php5-mysql                                      install
Scott
  • 267
  • 1
  • 3
  • 11

4 Answers4

9

Probably you need to install the CLI (command line interpreter) package. In Ubuntu or Debian this can be done via apt-get install php5-cli

akirk
  • 338
  • 4
  • 9
2

Most distributions split mod_php (the Apache module) and the PHP command line executable into separate packages. You will need to find the CLI package and install it.

Quentin
  • 1,157
  • 6
  • 10
0

If you believe that php is already on the system you can try

locate php

to find the program.

borrible
  • 101
  • 1
0

As akirk has hinted, the PHP which runs stuff on your webserver is probably not the same bit of code of which runs stuff from the command line.

Without knowing what distribution of Linux this is / what non-standard configurations have been applied we can't advise how to install the appropriate version of PHP / determine the location of an existing installation.

symcbean
  • 21,009
  • 1
  • 31
  • 52