path to php binary not found

They have: 10 posts

Joined: May 2006

Hey there. Ok well I don't know if anyone can help me with my problem that i'm running into but i'm hoping to maybe find some help. I've got this php script I'm installing, which for the most part if they aren't too complex I am usually successful. Going through the installation and getting hung up because it cannot find the path to my php binary. I'm looking at my php info for my server and am entering what I think is the correct path and still nothing. Banging head, these are the paths that I put in but it keeps coming up not found. Of course tech support only told me how to view my php info. Anybody have any suggestions?

/usr/local/hdc/php

/usr/local/hdc/php/lib/php

Greg K's picture

He has: 2,145 posts

Joined: Nov 2003

If you have shell access (telnet), once logged in, use which php and that should give you the location to use.

If you don't have shell, try one of these:

save a php page with just the following: <? echo system('which php'); ?> and then call the page, this should tell you the location of PHP.

if that doesn't work, try checking one of the paths listed under path in the ENVIRONMENT section of the output of this code: <? phpinfo(); ?>. Notes: 1. On both my servers, the correct location was the last path listed. 2. These are the PATHS, not the location, so you will have to add /php to the end when you try them.

-Greg

Abhishek Reddy's picture

He has: 3,348 posts

Joined: Jul 2001

What version of PHP is it? For PHP 5, the binary should be inside a bin/ folder something like this: /usr/lib/php5/bin/.

However, for standard installations of PHP (any version), there should be a link to the binary, called /usr/bin/php or /bin/php. Run whereis php in your shell and identify the path.

Whatever you think the path of the binary is, you can test it by going into it in your shell and try running ./php --version. If it prints the version and copyright information, then you've got the right path.

Edt: since you have Webmin, you can run shell commands by going to the "Command shell" page, if you weren't aware. Smiling

Abhishek Reddy's picture

He has: 3,348 posts

Joined: Jul 2001

Also, what OS and distribution are you on? In Debian GNU/Linux, for instance, you'll have to install the php4-cli or php5-cli package to get the binary.

They have: 10 posts

Joined: May 2006

ok, i've tried the suggestions you both made and I'm not having much luck. I have looked over the phpinfo over and over trying to see if I could find the right path but lol i just dont know what I'm looking for. Could I show you the phpinfo page via PM or something?

Abhishek Reddy's picture

He has: 3,348 posts

Joined: Jul 2001

phpinfo didn't look helpful on my machines.

Let's establish if you have shell access first. Do you have shell access?

If you do not have direct shell access, are you able to use the "Command shell" in Webmin? (Assuming this is your Webmin account -- if not, is there an equivalent facility in you control panel?)

Secondly, what OS/distribution are you on?

Smiling

They have: 10 posts

Joined: May 2006

yep i have shell access. I tried some of your suggestions and came up empty. the server is running apache and linux

Abhishek Reddy's picture

He has: 3,348 posts

Joined: Jul 2001

Any idea which distribution of Linux? Different ones will use different commands to search and install packages, which you may need to... Wink

They have: 10 posts

Joined: May 2006

Redhat Linux Fedora 4?

They have: 10 posts

Joined: May 2006

this is what my host tells me is installed on the server

Fedora Core 4

Apache

PHP

MySql

SquirelMail

Webmin

Abhishek Reddy's picture

He has: 3,348 posts

Joined: Jul 2001

The default PHP on Fedora Core 4 is php-5.0.4. The package provides a file /usr/bin/php. The path to the binary is /usr/bin, and the executable binary is /usr/bin/php.

If you do not have this file, you might have an older version of PHP, or you are using non-standard paths, or your installation went wrong at some point.

When you run whereis php in shell, you get no results? You may need to run updatedb in shell as the root user once first, so it caches the file paths on your system for whereis. (Note: updatedb takes a while to process, but you only need to do it once every so often.)

Post the results of your whereis search here. Smiling

They have: 10 posts

Joined: May 2006

> whereis php
php:

this is what i get

They have: 10 posts

Joined: May 2006

found out what my problem was, didnt have to do with the php at all. it had to do with the version of the script I had versus the license number.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.