I have 2 LAMP servers with ubuntu 10.04... both with php5 successfully installed.

on server1 i run the command # type php in terminal and the response is:

"php is /usr/bin/php"

however in server2 I run the same command and I get this:

-bash: type: php: not found

both servers have php5 installed via this:

sudo aptitude install libapache2-mod-php5 php5 php5-common php5-curl php5-dev php5-gd php5-imagick php5-mcrypt php5-memcache php5-mhash php5-mysql php5-pspell php5-snmp php5-sqlite php5-xmlrpc php5-xsl

why does server2 show "not found" while server1 if just fine?

Please help! thanks

link|improve this question
Is php in $PATH on the second server? – CanSpice Feb 14 at 22:37
1  
Belongs on Super User – Ex Umbris Feb 14 at 22:38
If PHP is installed in /usr/bin on server2 as well, try echo $PATH from the command prompt and see if /usr/bin is not in your path for some reason. – drew010 Feb 14 at 22:39
hey drew, this is the output: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games ... looks like '/usr/bin' is there – Rees Feb 14 at 22:46
What does type type output? It should say type is a shell builtin. – wallyk Feb 14 at 22:49
show 3 more comments
feedback

migrated from stackoverflow.com Feb 14 at 23:51

This question came from our site for professional and enthusiast programmers.

2 Answers

found it! need to install the package that allows you to run php via the terminal.

ubuntu official documentation: https://help.ubuntu.com/10.04/serverguide/C/php5.html

sudo apt-get install php5-cli
link|improve this answer
please accept your answer (when you're able to, it may need some time) to close out this question – Rich Homolka Feb 15 at 16:49
there is still a delay. perhaps a vote up will allow this immediately? – Rees Feb 15 at 16:57
feedback

PHP comes in several forms (Server APIs): CLI, CGI, Apache, Java Servlet... Each of them has a separate binary.

  • The php command is the CLI version, intended only for running scripts on your shell. Apache/LAMP does not use it.

  • Apache uses the Apache module version, which comes in the libapache-mod-php5 package and does not have a visible command.

In other words, there is nothing wrong. You're just looking for a different PHP SAPI.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.