LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 05-24-2008, 02:39 PM   #1
sneakyimp
Senior Member
 
Registered: Dec 2004
Posts: 1,056

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:
Code:
linux_prompt# php -q my_script.php
but other times I must type in the full path to the php executable like this:
Code:
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, 01:13 AM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

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


Cheers,
Tink
 
Old 05-25-2008, 02:13 PM   #3
sneakyimp
Senior Member
 
Registered: Dec 2004
Posts: 1,056

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, 06:12 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,358

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
For server to server differences, it means its not always being set in the PATH var.
Fundamentally, you've got
/etc/profile
which is applied to all user logins, and
.bash_profile
which is a hidden file in the home dir of each user and can contain different info eg PATH definitions, for each user.
HTH
 
Old 05-26-2008, 05:38 PM   #5
seraphim172
Member
 
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 04:30 AM.
 
  


Reply



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 05:23 AM
Run any Script without metioning the full path shipon_97 Linux - Newbie 2 08-08-2006 10:49 PM
get full path of uploaded file in php spoody_goon Programming 2 05-10-2005 07:32 PM
How to start a Tcl/Tk script by simply invoking the script file itself ? cyu021 Programming 2 10-10-2004 11:00 AM
php mail script return path richard22 Linux - Software 1 08-22-2003 04:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:36 AM.

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