Solved

Running PHP from Debian command line

Posted on 2009-07-02
11
669 Views
Last Modified: 2013-12-06
I have installed the base version of Debian, Apache and PHP5.
Apache can run php scripts  but I can't for the life of me find the php executable in the file system so that I can run php from the command line.

When I run apt-get install php5 I am told its already installed.

Where is the php executable hiding or how can I find out?

find / -name "php*" -print| while read file; do file $file; done
/var/lib/php5: sticky directory
/var/lib/dpkg/info/php5.list: ASCII text
/var/lib/dpkg/info/php5-common.conffiles: ASCII text
/var/lib/dpkg/info/php5-common.postrm: Bourne-Again shell script text executable
/var/lib/dpkg/info/php5-common.list: ASCII text
/var/lib/dpkg/info/php5-common.md5sums: ASCII text
/var/www/phpinfo.php: PHP script text
/var/cache/apt/archives/php5-common_5.2.6.dfsg.1-1+lenny3_i386.deb: Debian binary package (format 2.0)
/var/cache/apt/archives/php5_5.2.6.dfsg.1-1+lenny3_all.deb: Debian binary package (format 2.0)
/usr/lib/php5: directory
/usr/share/php5: directory
/usr/share/php5/php.ini-dist: ASCII English text
/usr/share/php5/php.ini-dist.cli: ASCII English text
/usr/share/doc/php5: symbolic link to `php5-common'
/usr/share/doc/php5-common: directory
/usr/share/doc/php5-common/examples/php.ini-dist: ASCII English text
/usr/share/doc/php5-common/examples/php.ini-recommended: ASCII English text
/usr/share/doc/php5-common/examples/php.ini-paranoid: ASCII English text, with very long lines
/usr/share/lintian/overrides/php5-common: ASCII text
/etc/php5: directory
/etc/php5/apache2/php.ini: ASCII English text
/etc/apache2/mods-enabled/php5.conf: symbolic link to `../mods-available/php5.conf'
/etc/apache2/mods-enabled/php5.load: symbolic link to `../mods-available/php5.load'
/etc/apache2/mods-available/php5.conf: ASCII text
/etc/apache2/mods-available/php5.load: ASCII text
/etc/cron.d/php5: ASCII English text

but to no avail.

Help please
BT
0
Comment
Question by:brothertom
  • 6
  • 2
  • 2
  • +1
11 Comments
 
LVL 29

Expert Comment

by:fosiul01
ID: 24767080
type

whereis php

or
which php

it will show the path for executable
0
 

Author Comment

by:brothertom
ID: 24767309
thats the point I guess, its not on the path and the executable does not seem to be on the filesystem, however Apache is obviously running something
0
 
LVL 29

Expert Comment

by:fosiul01
ID: 24767341
whereis php

did it return anything??

also which php

0
 

Author Comment

by:brothertom
ID: 24767524
nope:


debian:~# whereis php
php:
debian:~# which php
debian:~#
0
 

Author Comment

by:brothertom
ID: 24767534
Normally its in /usr/bin but not on this box
I'm new to Debian, so I may be missing something obvious.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 1

Expert Comment

by:activeitnetworks
ID: 24767561
type "find / -name php" in a terminal, it should return the location of the php executable, if not, that means you somehow got php_cgi but not php cli.

if that's the case, type "apt-get install php" to install the cli
0
 

Author Comment

by:brothertom
ID: 24767573
but if I run the following via the Apache webserver, php is obivously installed - see attached pdf - any help?

<?php

phpinfo()

?>
phpinfo.pdf
0
 

Author Comment

by:brothertom
ID: 24767794
the php_cgi seems plausable, but when I run apt-get, I get the following - can I force a re-install of php5 without screwing up apache?

debian:~# apt-get install php
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Couldn't find package php
debian:~#
debian:~#
debian:~# apt-get install php5
Reading package lists... Done
Building dependency tree
Reading state information... Done
php5 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
0
 
LVL 1

Expert Comment

by:activeitnetworks
ID: 24767832
if you do a backup of your configuration files, I don't see it failing, I can't test it here but I'm pretty sure you can force a re-install of the php5 package without breaking apache.

I wouldn't try on a production server before confirming.
0
 
LVL 3

Accepted Solution

by:
psycle earned 500 total points
ID: 24767909
Don't reinstall everything.... that's not the problem.  install the php5-cli package.  It's not installed by default with the php5 package.
0
 

Author Comment

by:brothertom
ID: 24768403
That did the job, thanks psycle.

0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Wordpress type image upload 10 32
lastpass auto fill login form 5 25
Adding Extra Information box 4 26
PC upgrade to Linux Mint 7 36
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
If you use Debian 6 Squeeze and you are tired of looking at the childish graphical GDM login screen that is used by default, here's an easy way to change it. If you've already tried to change it you've probably discovered that none of the old met…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now