?
Solved

Running PHP from Debian command line

Posted on 2009-07-02
11
Medium Priority
?
692 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
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 a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

752 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