Click here to get back home

php in terminal shell

 HomeNewsGroups | Search | About
 comp.lang.php    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
php in terminal shell misterparker 07-16-2008
Posted by misterparker on July 16, 2008, 9:44 am
Please log in for more thread options
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?

Posted by Jerry Stuckle on July 16, 2008, 11:30 am
Please log in for more thread options
misterparker@gmail.com wrote:
> 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?
>

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

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================


Posted by Toby A Inkster on July 17, 2008, 8:31 am
Please log in for more thread options
misterparker wrote:

> 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?

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 <http://barebones.com/>.

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 2.6.24.4-1mnbcustom-g5n1, up 25 days, 20:23.]
[Now Playing: Ed Harcourt - People are getting younger]

Extending hCard with RDFa
http://tobyinkster.co.uk/blog/2008/07/16/hcard-rdfa/

Similar ThreadsPosted
terminal php September 8, 2006, 6:49 am
terminal locks up upon second running of this CLI PHP function August 12, 2005, 9:56 am
Strange fatal error in terminal May 2, 2007, 12:08 am
Interactive PHP shell - can it be done? November 29, 2004, 7:54 pm
run php directly at shell June 3, 2006, 5:01 am
shell script + php July 25, 2008, 1:49 am
How can I run php scripts from a shell script? June 18, 2005, 2:27 pm
Running Shell Scripts February 1, 2006, 12:11 pm
How can I run shell command without getting return? March 8, 2006, 9:51 pm
Web host with SSH shell access? April 13, 2006, 12:35 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap