Solved

Running PHP from Debian command line

Posted on 2009-07-02
11
677 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article will explain how to establish a SSH connection to Ubuntu through the firewall and using a different port other then 22. I have set up a Ubuntu virtual machine in Virtualbox and I am running a Windows 7 workstation. From the Ubuntu vi…
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.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

808 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