0

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
chrisjlee
  • 1,005
  • 2
  • 13
  • 21
  • 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: http://www.linode.com/stackscripts/view/?StackScriptID=3207 – chrisjlee Mar 27 '12 at 16:58
  • I searched for php5 in the script and it looks like it might install it, but I don`t know stackscripts so I can't help you much more than that. Did you try simply installing the package and testing it? – gparent Mar 27 '12 at 17:03
  • @gparent yeah looks like it's not installing because it's trying to resolve the host and a 404 is returned each time it tries to install php. – chrisjlee Mar 27 '12 at 17:12
  • Are you able to resolve other hosts? For instance, you can type `host www.google.ca` to try and resolve that domain name. If not, check your `/etc/resolv.conf` file and make sure nameservers are specified. – gparent Mar 27 '12 at 17:14
  • @gparent appreciate your help thus far. thanks you - looks like it is resolving addresses fine. – chrisjlee Mar 27 '12 at 17:21
  • So only the archive that contains the php5-cli package cannot be resolved? Are you using a custom repository by any chance? – gparent Mar 27 '12 at 17:23

3 Answers3

1

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.

Lunar_Lamp
  • 196
  • 4
1

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:~#
gparent
  • 3,601
  • 2
  • 24
  • 28
0

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
Jim B
  • 24,081
  • 4
  • 36
  • 60
rahuL
  • 692
  • 3
  • 12
  • 31