Contact SalesSitemapCustomer Login

Warning: mysql_connect() [/function.mysql-connect]: Can't connect to MySQL server on 'coredb-01.spry.com' (13) in [path]/vpslink_template_files/contextual_ads.inc.php on line 56

Go Back   VPSlink Forums > Operating Systems > Ubuntu

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 01-21-2010, 08:10 PM
Junior Member
 
Join Date: Jan 2010
Posts: 5
Question PHP CLI in Ubuntu 8.04-LAMP

Dear Friends,

I'm running Ubuntu 8.04-LAMP and don't seem to find php command line interface anywhere in the system.
I've been trying:

# which php
# php -v
# /usr/local/bin/php
# /usr/bin/php

The server is running allright. PHP and Apache work together fine, but where is it hiding?

Thank you for helping me!
Reply With Quote
  #2 (permalink)  
Old 01-21-2010, 09:17 PM
Administrator
 
Join Date: Dec 2007
Posts: 1,141
Default

Have you tried sudo apt-get install php5-cli ..?
Reply With Quote
  #3 (permalink)  
Old 01-21-2010, 11:42 PM
Senior Member
 
Join Date: Jul 2007
Location: 127.0.0.1
Posts: 389
Default

Quote:
Originally Posted by carllee View Post
but where is it hiding?
Debian Lenny:
PHP Code:
[76][nullamatix ~]:# aptitude show php5-cli
Packagephp5-cli
State
installed
Automatically installed
yes
Version
5.2.6.dfsg.1-1+lenny4
Priority
optional
Section
web
Maintainer
Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>
Uncompressed Size5419k
Depends
libbz2-1.0libc6 (>= 2.7-1), libcomerr2 (>= 1.01), libdb4.6libkrb53 (>= 1.6.dfsg.2), libncurses5 (>= 5.6+20071006-3), libpcre3 (>= 7.4), libssl0.9.8 (>= 0.9.8f-5), libxml2 (>=
         
2.6.28), zlib1g (>= 1:1.1.4), mime-supportphp5-common (= 5.2.6.dfsg.1-1+lenny4), libmagic1ucftzdata
Suggests
php-pear
Provides
phpapi-20060613+lfs
Description
command-line interpreter for the php5 scripting language
 This package provides the 
/usr/bin/php5 command interpreteruseful for testing PHP scripts from a shell, or perhaps even performing general shell scripting tasks, if you're frightened of
 Perl and Python. 
 
 The following extensions are built in: bcmath bz2 calendar ctype date dba dom exif filter ftp gettext hash iconv json libxml mbstring mime_magic ncurses openssl pcntl pcre posix Reflection
 session shmop SimpleXML soap sockets SPL standard sysvmsg sysvsem sysvshm tokenizer wddx xml xmlreader xmlwriter zip zlib. 
 
 PHP5 is an HTML-embedded scripting language. Much of its syntax is borrowed from C, Java and Perl with a couple of unique PHP-specific features thrown in. The goal of the language is to
 allow web developers to write dynamically generated pages quickly. This version of PHP5 was built with the Suhosin patch.
Homepage: http://www.php.net/

[77][nullamatix ~]:# 
/usr/bin/php5, if installed, should work...

PHP Code:
[80][nullamatix ~]:# /usr/bin/php5 -v
PHP 5.2.6-1+lenny4 with Suhosin-Patch 0.9.6.2 (cli) (builtNov 22 2009 02:38:03
Copyright (c1997-2008 The PHP Group
Zend Engine v2.2.0
Copyright (c1998-2008 Zend Technologies
[81][nullamatix ~]:# /usr/bin/php5-cgi -v
PHP 5.2.6-1+lenny4 with Suhosin-Patch 0.9.6.2 (cgi-fcgi) (builtNov 22 2009 02:20:54)
Copyright (c1997-2008 The PHP Group
Zend Engine v2.2.0
Copyright (c1998-2008 Zend Technologies
[82][nullamatix ~]:
Reply With Quote
  #4 (permalink)  
Old 01-22-2010, 08:07 AM
Junior Member
 
Join Date: Jan 2010
Posts: 5
Default

Dear DanL@VPSLink,

yes, that was the first thing I've tried. But it throws some very obscure errors:

# sudo 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

I don't seem to find any solution via google. Is something wrong with aptitude servers? I did not change any of the default settings.

Thank you in advance for your help!
Reply With Quote
  #5 (permalink)  
Old 01-22-2010, 10:17 AM
Senior Member
 
Join Date: Jun 2008
Posts: 221
Default

Try updating your package repositories:
Code:
sudo aptitude update
If the install doesn't work after that, then I'd suggest posting the contents of your apt sources file (/etc/apt/sources.list) for a forum member to check.
Reply With Quote
  #6 (permalink)  
Old 01-22-2010, 12:06 PM
Senior Member
 
Join Date: Jul 2007
Location: 127.0.0.1
Posts: 389
Default

Quote:
Originally Posted by carllee View Post
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

I don't seem to find any solution via google. Is something wrong with aptitude servers? I did not change any of the default settings.
Type this command and paste the results here:

Code:
cat /etc/apt/sources.list
Reply With Quote
  #7 (permalink)  
Old 01-22-2010, 02:17 PM
Junior Member
 
Join Date: Jan 2010
Posts: 5
Default

Preamble:
I'm not allowed to post URLs, as I am yet to make 15 post. So scheme part of the URLs is replaced with [scheme://]

Updated aptitude using code supplied earlier by chriss:

Code:
# sudo aptitude update
Hit [scheme://]us.archive.ubuntu.com hardy Release.gpg
Get:1 [scheme://]us.archive.ubuntu.com hardy-updates Release.gpg [189B]
Hit [scheme://]us.archive.ubuntu.com hardy Release
Get:2 [scheme://]us.archive.ubuntu.com hardy-updates Release [58.5kB]
Hit [scheme://]us.archive.ubuntu.com hardy/universe Packages
Hit [scheme://]us.archive.ubuntu.com hardy/universe Sources
Hit [scheme://]us.archive.ubuntu.com hardy/multiverse Packages
Hit [scheme://]us.archive.ubuntu.com hardy/multiverse Sources
Get:3 [scheme://]us.archive.ubuntu.com hardy-updates/universe Packages [227kB]
Get:4 [scheme://]us.archive.ubuntu.com hardy-updates/universe Sources [46.5kB]
Get:5 [scheme://]us.archive.ubuntu.com hardy-updates/multiverse Packages [29.3kB]
Get:6 [scheme://]us.archive.ubuntu.com hardy-updates/multiverse Sources [5220B]
Fetched 367kB in 2s (145kB/s)                      
Reading package lists... Done
Tried to install php5-cli then. No success:

Code:
# sudo 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
List of the source files:

Code:
# cat /etc/apt/sources.list
#deb [scheme://]mirror.vpslink.com/ubuntu hardy main
#deb [scheme://]mirror.vpslink.com/ubuntu hardy-updates main
#deb [scheme://]mirror.vpslink.com/ubuntu hardy-security main
deb [scheme://]us.archive.ubuntu.com/ubuntu/ hardy universe
deb-src [scheme://]us.archive.ubuntu.com/ubuntu/ hardy universe
deb [scheme://]us.archive.ubuntu.com/ubuntu/ hardy-updates universe
deb-src [scheme://]us.archive.ubuntu.com/ubuntu/ hardy-updates universe
deb [scheme://]us.archive.ubuntu.com/ubuntu/ hardy multiverse
deb-src [scheme://]us.archive.ubuntu.com/ubuntu/ hardy multiverse
deb [scheme://]us.archive.ubuntu.com/ubuntu/ hardy-updates multiverse
deb-src [scheme://]us.archive.ubuntu.com/ubuntu/ hardy-updates multiverse
Reply With Quote
  #8 (permalink)  
Old 01-22-2010, 04:32 PM
Senior Member
 
Join Date: Jul 2007
Location: 127.0.0.1
Posts: 389
Default

Looks like php5-cli is in the ubuntu security repos, which doesn't appear to exist in your sources.list

Try adding this to your sources list, then apt-get update, apt-get install php5-cli or apt-get install php5

Code:
deb http://security.ubuntu.com/ubuntu hardy-security main
Ubuntu -- Details of package php5-cli in hardy
http://packages.ubuntu.com/hardy/i386/php5-cli/download
Reply With Quote
  #9 (permalink)  
Old 01-22-2010, 07:53 PM
Junior Member
 
Join Date: Jan 2010
Posts: 5
Default

Dear GuyPatterson,

I have updated sources list as you've suggested. The new list:

Code:
# cat /etc/apt/sources.list
#deb [scheme://]mirror.vpslink.com/ubuntu hardy main
#deb [scheme://]mirror.vpslink.com/ubuntu hardy-updates main
#deb [scheme://]mirror.vpslink.com/ubuntu hardy-security main
deb [scheme://]us.archive.ubuntu.com/ubuntu/ hardy universe
deb-src [scheme://]us.archive.ubuntu.com/ubuntu/ hardy universe
deb [scheme://]us.archive.ubuntu.com/ubuntu/ hardy-updates universe
deb-src [scheme://]us.archive.ubuntu.com/ubuntu/ hardy-updates universe
deb [scheme://]us.archive.ubuntu.com/ubuntu/ hardy multiverse
deb-src [scheme://]us.archive.ubuntu.com/ubuntu/ hardy multiverse
deb [scheme://]us.archive.ubuntu.com/ubuntu/ hardy-updates multiverse
deb-src [scheme://]us.archive.ubuntu.com/ubuntu/ hardy-updates multiverse
deb [scheme://]security.ubuntu.com/ubuntu hardy-security main
Then I ran apt-get update. And tried to installed missing php5-cli. Some obscure failures as a result:

Code:
# apt-get install php5-cli
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libapache2-mod-php5 php5-common php5-mysql
Suggested packages:
  php-pear
The following NEW packages will be installed:
  php5-cli
The following packages will be upgraded:
  libapache2-mod-php5 php5-common php5-mysql
3 upgraded, 1 newly installed, 0 to remove and 45 not upgraded.
Need to get 5332kB of archives.
After this operation, 5411kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get:1 [scheme://]security.ubuntu.com hardy-security/main php5-cli 5.2.4-2ubuntu5.10 [2478kB]
Get:2 [scheme://]security.ubuntu.com hardy-security/main php5-mysql 5.2.4-2ubuntu5.10 [65.2kB]
Get:3 [scheme://]security.ubuntu.com hardy-security/main libapache2-mod-php5 5.2.4-2ubuntu5.10 [2472kB]
Get:4 [scheme://]security.ubuntu.com hardy-security/main php5-common 5.2.4-2ubuntu5.10 [317kB]
Fetched 5332kB in 4s (1180kB/s)               
Use of uninitialized value in scalar chomp at /usr/share/perl5/Debconf/Encoding.pm line 17.
Use of uninitialized value in pattern match (m//) at /usr/share/perl5/Debconf/FrontEnd/ScreenSize.pm line 33, <> line 4.
Use of uninitialized value in pattern match (m//) at /usr/share/perl5/Debconf/FrontEnd/ScreenSize.pm line 48, <> line 4.
Can't fork at /usr/sbin/dpkg-preconfigure line 67, <> line 4.
Selecting previously deselected package php5-cli.
(Reading database ... 13798 files and directories currently installed.)
Unpacking php5-cli (from .../php5-cli_5.2.4-2ubuntu5.10_i386.deb) ...
dpkg: error processing /var/cache/apt/archives/php5-cli_5.2.4-2ubuntu5.10_i386.deb (--unpack):
 fork failed: Cannot allocate memory
dpkg: error while cleaning up:
 fork failed: Cannot allocate memory
dpkg: error while cleaning up:
 fork failed: Cannot allocate memory
Errors were encountered while processing:
 /var/cache/apt/archives/php5-cli_5.2.4-2ubuntu5.10_i386.deb
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)
I honestly have never seen such thing. Any ideas?
Thank you!
Reply With Quote
  #10 (permalink)  
Old 01-22-2010, 11:04 PM
Administrator
 
Join Date: Dec 2007
Posts: 1,141
Default

Code:
fork failed: Cannot allocate memory
This error message indicates that your VPS has run out of memory to complete the operation - see our Monitor Linux System Resources guide at the VPSLink Wiki for suggestions.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT. The time now is 11:25 AM.


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0