How to find path to Linux programs?
'nough said
Thread Starter
Join Date: Sep 2002
Location: Raynes Park
Age: 58
Posts: 1,025
Likes: 0
Received 0 Likes
on
0 Posts
How to find path to Linux programs?
Dear Linux-gurus,
Can someone remind the command to display the path to programs - I need to confirm where PHP is running from on my server - It's supposed to be /usr/local/lib/php.
I seem to recall it's something like "where php" or "what php" or similar and, for once, Google is no help (or I'm not searching the correct keyword).
Cheers
Charles
Can someone remind the command to display the path to programs - I need to confirm where PHP is running from on my server - It's supposed to be /usr/local/lib/php.
I seem to recall it's something like "where php" or "what php" or similar and, for once, Google is no help (or I'm not searching the correct keyword).
Cheers
Charles
Join Date: Sep 2002
Location: Chichester, UK
Posts: 1,650
Likes: 0
Received 0 Likes
on
0 Posts
I think whereis is what you're looking for, e.g.
>evo@camel: whereis konqueror
konqueror: /opt/kde3/bin/konqueror
alternatively, you can do rpm -qpil filename.rpm to find out where it puts things - not quite what you're after, but also useful for tracking things down.
>evo@camel: whereis konqueror
konqueror: /opt/kde3/bin/konqueror
alternatively, you can do rpm -qpil filename.rpm to find out where it puts things - not quite what you're after, but also useful for tracking things down.
Supercalifragilistic
expialidocious
expialidocious
Join Date: Sep 2001
Location: Essex, UK
Posts: 588
Likes: 0
Received 0 Likes
on
0 Posts
Finding Files in Linux at:
http://www.comptechdoc.org/os/linux/...ugfinding.html
has a good summary, I stumbled across it looking for examples of the locate command.
http://www.comptechdoc.org/os/linux/...ugfinding.html
has a good summary, I stumbled across it looking for examples of the locate command.
'nough said
Thread Starter
Join Date: Sep 2002
Location: Raynes Park
Age: 58
Posts: 1,025
Likes: 0
Received 0 Likes
on
0 Posts
Thanks Evo - that's exactly what I was looking for.
whereis php gives me:
php: /usr/bin/php /etc/php.ini /usr/lib/php /usr/lib/php.ini
/usr/local/bin/php /usr/local/lib/php /usr/local/lib/php.ini /usr/include/php
Do you know if it's normal to have /usr/bin/php and /usr/local/bin/php - that looks like duplicate installations to me?
Thanks Memetic for the link - it has been bookmarked
whereis php gives me:
php: /usr/bin/php /etc/php.ini /usr/lib/php /usr/lib/php.ini
/usr/local/bin/php /usr/local/lib/php /usr/local/lib/php.ini /usr/include/php
Do you know if it's normal to have /usr/bin/php and /usr/local/bin/php - that looks like duplicate installations to me?
Thanks Memetic for the link - it has been bookmarked
Join Date: Sep 2002
Location: London, UK
Posts: 778
Likes: 0
Received 0 Likes
on
0 Posts
'whereis X' will tell you if the program X is in one of the typical locations for executables.
If you want to know WHICH version of the executable X will be run if you type the command without specifyin a path then you need to use 'which X'.
Sometimes you'll find /usr/bin/php is a symbolic link to /usr/local/bin/php. To find out, examine the output of:
ls -al /usr/bin/php
If it isn't you could try:
diff /usr/local/bin/php /usr/bin/php
to see if they're the same. If they're not then try:
/usr/bin/php -version
and
/usr/local/bin/php -version
to see which version is which.
If you want to know WHICH version of the executable X will be run if you type the command without specifyin a path then you need to use 'which X'.
Sometimes you'll find /usr/bin/php is a symbolic link to /usr/local/bin/php. To find out, examine the output of:
ls -al /usr/bin/php
If it isn't you could try:
diff /usr/local/bin/php /usr/bin/php
to see if they're the same. If they're not then try:
/usr/bin/php -version
and
/usr/local/bin/php -version
to see which version is which.
'nough said
Thread Starter
Join Date: Sep 2002
Location: Raynes Park
Age: 58
Posts: 1,025
Likes: 0
Received 0 Likes
on
0 Posts
Thanks Drauk - which did it and you're correct about the symbolic link to /usr/local/bin/php. Just got to figure why my cron job is still not working. Just wished there was command such as
whatisthematterwithyou cron.php
whatisthematterwithyou cron.php
Join Date: Sep 2002
Location: London, UK
Posts: 778
Likes: 0
Received 0 Likes
on
0 Posts
I don't know much about PHP I'm afraid and it's hard to know where to look without more details of your problem. However, 2 thoughts:
1) Have you tried this simple script in order to get a lot of information about PHP and how it is configured on your system? Create a file with (just) the following:
<?php phpinfo() ?>
You can then execute this from your web browser or from the command line.
2) Problems with CRON jobs are most often related to the user environment in which they are running - mostly environment variables that are setting the user's path, default langauge, timezone etc. Try printing out the values from the script in CRON to check they are what you expect them to be.
1) Have you tried this simple script in order to get a lot of information about PHP and how it is configured on your system? Create a file with (just) the following:
<?php phpinfo() ?>
You can then execute this from your web browser or from the command line.
2) Problems with CRON jobs are most often related to the user environment in which they are running - mostly environment variables that are setting the user's path, default langauge, timezone etc. Try printing out the values from the script in CRON to check they are what you expect them to be.