Re: [PHP] Re: whoami explanation

2009-03-04 Thread Jochem Maas
Robert Cummings schreef:
 On Tue, 2009-03-03 at 11:27 -0500, PJ wrote:
 Shawn McKenzie wrote:
 PJ wrote:
   
 This really needs some explanation
 I found this on the web:
 ?php echo `whoami`; ?
 with it there was the comment the direction of those single-quotes 
 matters
 (WHY ?)
 and it works

 But this (_*FROM THE PHP MANUAL***_ * -  exec()* executes the given
 /command/ ) does not,
 COPIED AND PASTED:
 |?php
 // outputs the username that owns the running php/httpd process
 // (on a system with the whoami executable in the path)
 echo exec('whoami');
 ? |
 What is going on here?
 And I often find such discrepancies in examples - and some wonder why I
 seem to be so stupid... and don't know the fundamentals... :-\
 
 Others have shown how exec() returns the output.  If you use
 shell_exec() it's the same as using the backticks:

 ?php echo `whoami`; ?

 -or-

 ?php echo shell_exec(whoami); ?

 You can use single quotes here also, i used double so you can easily
 tell they are not backticks
   
 What is not clear to me is why would I need to use a shell? What kind of
 situations call for it's use?
 
 You must be a point and clicker.

a PACman.

 Many, many, many people use the shell
 to perform basic system administration, edit config files, even edit
 source code. There are thousands of shell commands available at the
 touch of your fingertips while in a shell. Using the backticks or exec()
 function allows one to utilize these programs as part of a larger
 program.

of course the real answer is no-one can explain who you are, you have to
find out for yourself

 
 Cheers,
 Rob.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: whoami explanation

2009-03-03 Thread Shawn McKenzie
PJ wrote:
 This really needs some explanation
 I found this on the web:
 ?php echo `whoami`; ?
 with it there was the comment the direction of those single-quotes matters
 (WHY ?)
 and it works
 
 But this (_*FROM THE PHP MANUAL***_ * -  exec()* executes the given
 /command/ ) does not,
 COPIED AND PASTED:
 |?php
 // outputs the username that owns the running php/httpd process
 // (on a system with the whoami executable in the path)
 echo exec('whoami');
 ? |
 What is going on here?
 And I often find such discrepancies in examples - and some wonder why I
 seem to be so stupid... and don't know the fundamentals... :-\

Others have shown how exec() returns the output.  If you use
shell_exec() it's the same as using the backticks:

?php echo `whoami`; ?

-or-

?php echo shell_exec(whoami); ?

You can use single quotes here also, i used double so you can easily
tell they are not backticks

-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: whoami explanation

2009-03-03 Thread PJ
Shawn McKenzie wrote:
 PJ wrote:
   
 This really needs some explanation
 I found this on the web:
 ?php echo `whoami`; ?
 with it there was the comment the direction of those single-quotes matters
 (WHY ?)
 and it works

 But this (_*FROM THE PHP MANUAL***_ * -  exec()* executes the given
 /command/ ) does not,
 COPIED AND PASTED:
 |?php
 // outputs the username that owns the running php/httpd process
 // (on a system with the whoami executable in the path)
 echo exec('whoami');
 ? |
 What is going on here?
 And I often find such discrepancies in examples - and some wonder why I
 seem to be so stupid... and don't know the fundamentals... :-\
 

 Others have shown how exec() returns the output.  If you use
 shell_exec() it's the same as using the backticks:

 ?php echo `whoami`; ?

 -or-

 ?php echo shell_exec(whoami); ?

 You can use single quotes here also, i used double so you can easily
 tell they are not backticks
   
What is not clear to me is why would I need to use a shell? What kind of
situations call for it's use?

-- 

Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: whoami explanation

2009-03-03 Thread Daniel Brown
On Tue, Mar 3, 2009 at 11:27, PJ af.gour...@videotron.ca wrote:

 What is not clear to me is why would I need to use a shell? What kind of
 situations call for it's use?

On what kind of programming did you spend those years?

-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: whoami explanation

2009-03-03 Thread Bob McConnell
From: PJ
 
 What is not clear to me is why would I need to use a shell? What kind
of
 situations call for it's use?

It's a matter of expectations. I am still trying to figure out why
anyone would want a GUI on any version of Unix or Linux. They just slow
me down and make it very difficult to do any real work.

Bob McConnell

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: whoami explanation

2009-03-03 Thread Robert Cummings
On Tue, 2009-03-03 at 11:27 -0500, PJ wrote:
 Shawn McKenzie wrote:
  PJ wrote:

  This really needs some explanation
  I found this on the web:
  ?php echo `whoami`; ?
  with it there was the comment the direction of those single-quotes 
  matters
  (WHY ?)
  and it works
 
  But this (_*FROM THE PHP MANUAL***_ * -  exec()* executes the given
  /command/ ) does not,
  COPIED AND PASTED:
  |?php
  // outputs the username that owns the running php/httpd process
  // (on a system with the whoami executable in the path)
  echo exec('whoami');
  ? |
  What is going on here?
  And I often find such discrepancies in examples - and some wonder why I
  seem to be so stupid... and don't know the fundamentals... :-\
  
 
  Others have shown how exec() returns the output.  If you use
  shell_exec() it's the same as using the backticks:
 
  ?php echo `whoami`; ?
 
  -or-
 
  ?php echo shell_exec(whoami); ?
 
  You can use single quotes here also, i used double so you can easily
  tell they are not backticks

 What is not clear to me is why would I need to use a shell? What kind of
 situations call for it's use?

You must be a point and clicker. Many, many, many people use the shell
to perform basic system administration, edit config files, even edit
source code. There are thousands of shell commands available at the
touch of your fingertips while in a shell. Using the backticks or exec()
function allows one to utilize these programs as part of a larger
program.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: whoami explanation

2009-03-03 Thread Shawn McKenzie
PJ wrote:
 Shawn McKenzie wrote:
 PJ wrote:
   
 This really needs some explanation
 I found this on the web:
 ?php echo `whoami`; ?
 with it there was the comment the direction of those single-quotes matters
 (WHY ?)
 and it works

 But this (_*FROM THE PHP MANUAL***_ * -  exec()* executes the given
 /command/ ) does not,
 COPIED AND PASTED:
 |?php
 // outputs the username that owns the running php/httpd process
 // (on a system with the whoami executable in the path)
 echo exec('whoami');
 ? |
 What is going on here?
 And I often find such discrepancies in examples - and some wonder why I
 seem to be so stupid... and don't know the fundamentals... :-\
 
 Others have shown how exec() returns the output.  If you use
 shell_exec() it's the same as using the backticks:

 ?php echo `whoami`; ?

 -or-

 ?php echo shell_exec(whoami); ?

 You can use single quotes here also, i used double so you can easily
 tell they are not backticks
   
 What is not clear to me is why would I need to use a shell? What kind of
 situations call for it's use?
 

Well, if you need to run any executable on the server to have it do
something or return something.  Whether you need to get some information
from the system or run an executable that does something specific.
Maybe you want to do a 'ps -ef' to get processes on linux, or maybe you
want to start a service on windows 'netstart SOMESERVICE'.

-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: whoami explanation

2009-03-03 Thread PJ
Daniel Brown wrote:
 On Tue, Mar 3, 2009 at 11:27, PJ af.gour...@videotron.ca wrote:
   
 What is not clear to me is why would I need to use a shell? What kind of
 situations call for it's use?
 

 On what kind of programming did you spend those years?
   
Not really programming, more like overseeing the programming of others
(as a client) and trying to fix their awful mistakes about which I
learned from lists on the Net. I tinkered with some basic stuff and
looked into machine code back around `82... never very serious...
Now I'm trying to modify my daughter's ptahhotep.com to use MySql. It's
a learning experience.
My real profession if director and director of photography in motion
pictures and tv. :-D
I appreciate the help I'm getting here and the fact that I am tolerated
here (maybe just)...


-- 

Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: whoami explanation

2009-03-03 Thread PJ
Bob McConnell wrote:
 From: PJ
   
 What is not clear to me is why would I need to use a shell? What kind
 
 of
   
 situations call for it's use?
 

 It's a matter of expectations. I am still trying to figure out why
 anyone would want a GUI on any version of Unix or Linux. They just slow
 me down and make it very difficult to do any real work.

 Bob McConnell
   
Ok, I thought I understood. The only programs I use that are non-shell
on FreeBSD are openoffice  and FireFox3, and sometimes Gimp. I use the
shell for administration of the server and program installation and
maintenance... I suppose a shell on Windows would be the cmd but I never
thought of it as a shell. :-)

-- 

Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: whoami explanation

2009-03-03 Thread Daniel Brown
On Tue, Mar 3, 2009 at 11:48, PJ af.gour...@videotron.ca wrote:

[snip!]
 Now I'm trying to modify my daughter's ptahhotep.com to use MySql. It's
 a learning experience.

Through the years I've probably sounded like a broken record or
like I'm paid to endorse them or something, but I'd recommend checking
out PHPBuilder for some of this.  Specifically:

http://phpbuilder.com/columns/index.php3?cat=1subcat=2

Some other great sites for code snippets and examples are from
folks here on this list:

http://webbytedd.com/a.php
http://phpguru.org/

 and, of course, it should go without saying that Google and
the manual should be your first stop.


-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: whoami explanation

2009-03-03 Thread PJ
Daniel Brown wrote:
 On Tue, Mar 3, 2009 at 11:48, PJ af.gour...@videotron.ca wrote:
   
 [snip!]
   
 Now I'm trying to modify my daughter's ptahhotep.com to use MySql. It's
 a learning experience.
 

 Through the years I've probably sounded like a broken record or
 like I'm paid to endorse them or something, but I'd recommend checking
 out PHPBuilder for some of this.  Specifically:

 http://phpbuilder.com/columns/index.php3?cat=1subcat=2

 Some other great sites for code snippets and examples are from
 folks here on this list:

 http://webbytedd.com/a.php
 http://phpguru.org/

  and, of course, it should go without saying that Google and
 the manual should be your first stop.
   
Oh, I do go through some of that and when my brain has turned to php
mush, I turn to you guys to get my thrashing (and pretty good results) O:-)

-- 

Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: whoami explanation

2009-03-03 Thread Paul M Foster
On Tue, Mar 03, 2009 at 11:27:08AM -0500, PJ wrote:

snip

 What is not clear to me is why would I need to use a shell? What kind of
 situations call for it's use?

If you don't know the answer to that question, why would you ask the
original question? If you don't believe you don't have a use for this
material, don't worry about it. At the least, examine a book on the
subject, rather than asking questions here. If this was a
mission-critical part of your project and you need an immediate answer
now, then I understand asking the question here. But if the whole thing
is hypothetical, take the opportunity to read up on it; it's not
critical to your work at this point.

And asking us where a character is on your keyboard? Come on.

I'm the first guy in line to answer newbie questions if I can. And I've
castigated list members for framing their answers in a way which would
be impossible for newbies to understand. And I understand how things can
get confusing to newbies. But I sometimes reach a point where I begin to
wonder whether a newbie is actually paying attention. Or whether a
newbie is really just playing around, wasting our time because he won't
take the time to buy a book or carefully research an item on the web.

And FWIW, php.net has better documentation than that of any
other package I've ever seen. I keep a browser tab open to php.net at
all times.

Paul

-- 
Paul M. Foster

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php