php in terminal shell

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hey so I'm not new to php, but I'm no guru either, however recently (6
months) i have gotten a macbook, and have been playing around on the
terminal, come to find if you type "php" in the terminal, i'm pretty
sure its running php, because i can then type code, however, it
doesn't interpret the code until i press CTRL+D (which quits php) does
anyone know what keystroke or how to just interpret the typed code
without logging out for some quick php testing?

Re: php in terminal shell wrote:
Quoted text here. Click to load it

php -h shows you the command line options.  -a executes interactively.

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Re: php in terminal shell

misterparker wrote:

Quoted text here. Click to load it

The more usual way would be to create a file called "test.php" on your
desktop (or wherever) with all your PHP commands in it, using a text
editor such as TextWrangler < .

Then open your terminal and run "php ~/Desktop/test.php" and you'll see
the output. Keep TextWrangler and the terminal both open at once, and
switch between them, playing around until you get what you want.

Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux, up 25 days, 20:23.]
[Now Playing: Ed Harcourt - People are getting younger]

                         Extending hCard with RDFa

Site Timeline