Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 05-24-2008, 03:39 PM   #1
Senior Member
Registered: Dec 2004
Posts: 1,055

Rep: Reputation: 78
Invoking a PHP script - sometimes the full path is required

I have noticed that sometimes I can invoke a php script like this:
linux_prompt# php -q my_script.php
but other times I must type in the full path to the php executable like this:
linux_prompt# /usr/bin/php5 my_script.php
Why is that? I'm guessing there's an alias somewhere. Is it in my bash profile? Is it possible to create one alias that applies to *all* users of a linux box? Also, is it safe to use the path /usr/bin/php every time or will that path vary by linux distribution or php install?

Any help would be very much appreciated.
Old 05-25-2008, 02:13 AM   #2
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 913Reputation: 913Reputation: 913Reputation: 913Reputation: 913Reputation: 913Reputation: 913Reputation: 913
Are you seeing that different behaviour as the same user,
or are you su'ed to someone else?

Old 05-25-2008, 03:13 PM   #3
Senior Member
Registered: Dec 2004
Posts: 1,055

Original Poster
Rep: Reputation: 78
I'm not talking about different behavior on a single machine. I'm talking about different behavior from server to server.
Old 05-25-2008, 07:12 PM   #4
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.10, Centos 7.5
Posts: 17,682

Rep: Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490
For server to server differences, it means its not always being set in the PATH var.
Fundamentally, you've got
which is applied to all user logins, and
which is a hidden file in the home dir of each user and can contain different info eg PATH definitions, for each user.
Old 05-26-2008, 06:38 PM   #5
Registered: May 2008
Posts: 101

Rep: Reputation: 15
PATH issue

If the location of an application is not in your PATH, then you will have to type the full path name - this is true for every application, not only for PHP.

To run PHP from the command-line it has to have been built with the CLI option. This can be different among different servers.

Linux Archive

Last edited by seraphim172; 06-25-2008 at 05:30 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to use script sed with full path azeus Programming 8 03-14-2008 06:23 AM
Run any Script without metioning the full path shipon_97 Linux - Newbie 2 08-08-2006 11:49 PM
get full path of uploaded file in php spoody_goon Programming 2 05-10-2005 08:32 PM
How to start a Tcl/Tk script by simply invoking the script file itself ? cyu021 Programming 2 10-10-2004 12:00 PM
php mail script return path richard22 Linux - Software 1 08-22-2003 05:10 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:52 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration