Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am connecting through SSH to a Red Hat machine. I am not root. I try to localize the PHP interpreter (in Debian, that would be /usr/bin/php for example) but I don't find it. which is not installed and since I'm not root I cannot install rpm packages. I know php is installed because I can type php in terminal and it goes in read mode. I tried find / -type d -name php or find / -type f -name php and I got the output "terminated" which I guess means nothing was found. How could I locate php?

share|improve this question
    
is there maybe an alias set for "php". In Red Hat it should be under /usr/bin/ as well. –  Raffael Luthiger Feb 23 '11 at 10:49
    
@raffael ls /usr/bin or even ls /usr/local/bin show no php –  fabjoa Feb 23 '11 at 10:53
    
run alias and see if an alias has been set up for php. –  Iain Feb 23 '11 at 11:00
    
@Lain nope, tried alias y nothing set for php –  fabjoa Feb 23 '11 at 11:12

3 Answers 3

up vote 2 down vote accepted

If you can execute php, you can get phpinfo(). There you have information about interpreter itself.

php -i | grep '"_"'
share|improve this answer
    
found it! Thanks vartec! It was in an obscure /usr/local subfolder ! –  fabjoa Feb 23 '11 at 11:14

If you're using Bash:

type -a php

Which will tell you all the aliases, functions and executables (that are in your PATH) that "php" refers to.

Something similar will work in other shells.

Other commands you can try (besides which) are whereis and whence.

share|improve this answer
    
Thanks Dennis, it did the job! I would have set yours as answer but i already did for vartec's which did the trick too and I don't have enough reputation to vote you up but the feeling is here :) –  fabjoa Feb 23 '11 at 11:15

First check whether php-cli is installed.

rpm -qa | grep php-cli
share|improve this answer
    
I get the following error: cannot open Packages index using db3 - Permission denied (13) error: cannot open Packages database in /var/lib/rpm –  fabjoa Feb 23 '11 at 10:50
    
I suppose you have to do that as root or similar superuser permissions. –  coredump Feb 23 '11 at 11:00
    
On my installation I can run it as a normal user, you will have to contact your sysadmin then. –  Francois Wolmarans Feb 28 '11 at 13:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.