Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Currently trying to configure a linode server running on ubuntu 10.04. I utilized a stackscript (Default drupal profile) which seemed to run successfully. The log indicate so as well.

Then ssh'd into the server (as root) to try to configure php.

When i run a which php, which php5 they both return nothing. A which python returns something though.

I know where the default path to php but i usually just like to use it as confirmation that php exists.

Do i have to modify some configurations to enable which to work? Also tab completion doesn't seem to work for when i apt-get install?

Update:

Thanks for the suggestions guys. I've ran a couple commands and no luck either:

[ root@  ~ ]
$ dpkg -l |grep php
[ root@  ~ ]
$ apt-get install php5-cli
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package php5-cli is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package php5-cli has no installation candidate

Then i tried installing php and php cli:

[ root@  ~ ]
$ sudo apt-get install php5 php5-cli
sudo: unable to resolve host xxxxxxx
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package php5 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package php5 has no installation candidate
share|improve this question
    
You don't mention what is wrong in your question. Please add relevant information about what is actually not working. –  gparent Mar 27 '12 at 15:38
    
Sorry a which php returns null that's my issue. –  chrisjlee Mar 27 '12 at 15:42
2  
Do you have the php5-cli package installed? There's a php package that adds the relevant command line executable I believe. If it works, let me know and I'll reply as an official answer. –  gparent Mar 27 '12 at 15:44
    
dpkg -l |grep php will show installed packages with "php" in the name. –  cjc Mar 27 '12 at 16:25
    
@gparent i'm not sure if php is installed. i thought it was installed with the stack script here: linode.com/stackscripts/view/?StackScriptID=3207 –  chrisjlee Mar 27 '12 at 16:58
show 5 more comments

3 Answers

This is the behaviour I would expect to see, and on a recently installed 10.04 I have to hand, is the behaviour I see:

$ which python
/usr/bin/python
$ which php
$ echo $? #prints exit status of most recent command
1

From the which man page:

EXIT STATUS 0 if all specified commands are found and executable

   1      if one or more specified commands is nonexistent or not executable

   2      if an invalid option is specified

The most likely reason for this is that you do not have php installed, or at least, not within your $PATH.

share|improve this answer
add comment

Like I said in comments, there's a good chance PHP is simply not installed. There are two relevant packages: php5, and php5-cli. The latter lets you execute php files directly from command line:

platinum:~# apt-get remove php5-cli
platinum:~# which php
platinum:~#
platinum:~# apt-get install php5-cli
platinum:~# which php
/usr/bin/php
platinum:~#
share|improve this answer
add comment

I believe that PHP isn't installed at the moment on your Ubuntu box. There are 2 PHP packages to be installed - namely, php5 and php5-cli using the following commands (do not forget "sudo" in case you aren't root)

sudo apt-get install php5
sudo apt-get install php5-cli

Additionally, consider installing other related packages that may be desired like libapache2-mod-php5 to integrate with Apache 2, and php-pear for PEAR.

sudo apt-get install libapache2-mod-php5 php-pear
share|improve this answer
add comment

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.