Solved

Running PHP from Debian command line

Posted on 2009-07-02
11
678 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
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Php logic to add to date card 9 40
What is this? I've never seen this... 2 30
while read ID; do 4 60
P3P validator , ASP, PHP ,Https and Http links 3 14
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

730 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