Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question

migrated from stackoverflow.com Feb 14 '12 at 23:51

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

    
Is php in $PATH on the second server? –  CanSpice Feb 14 '12 at 22:37
    
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 '12 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 '12 at 22:46
    
What does type type output? It should say type is a shell builtin. –  wallyk Feb 14 '12 at 22:49
    
hey wallyk, yes output is: "type is a shell builtin" –  Rees Feb 14 '12 at 22:50

2 Answers 2

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
share|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 '12 at 16:49
    
there is still a delay. perhaps a vote up will allow this immediately? –  Rees Feb 15 '12 at 16:57

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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