how can i use php from command line ? step

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

try

Code: Select all

<?php
echo 'enter a number: ';
$number = (float)fgets(STDIN);
echo '->', $number;
?>
ms_dos10
Forum Commoner
Posts: 42
Joined: Tue Jul 25, 2006 8:10 am

Post by ms_dos10 »

sorry man , but i have more question .
STDIN , STDOUT and STDERR what's means?
can i run html file on command line if yes how ?
thanx for everything
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

ms_dos10 wrote:STDIN , STDOUT and STDERR what's means?
http://en.wikipedia.org/wiki/Standard_streams
ms_dos10 wrote:can i run html file on command line if yes how ?
I don't understand what you're asking.
ms_dos10
Forum Commoner
Posts: 42
Joined: Tue Jul 25, 2006 8:10 am

Post by ms_dos10 »

when i execute html file nothing well happen only the code show up on the screen as it's
is this way correct i can't execute it or i'm doing the wrong way
nickvd
DevNet Resident
Posts: 1027
Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:

Post by nickvd »

Why would you use HTML on the command line?
ms_dos10
Forum Commoner
Posts: 42
Joined: Tue Jul 25, 2006 8:10 am

Post by ms_dos10 »

this is my first time using php on the command line . i thing from ur question i'm wrong .
i get this also from ur question php on command line act like c or c++ . no web coding "HTML" , is that correct .
if there is no web coding how can i make form for my user interface to enter data or i have to use the black screen
i know my question is more but i want to learn man
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

You might be interested in http://gtk.php.net/
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

you might want to look into ncurses for somewhat prettier console user interface (though it is available for Win platform only if you have installed cygwin).
ms_dos10
Forum Commoner
Posts: 42
Joined: Tue Jul 25, 2006 8:10 am

Post by ms_dos10 »

thanx all of you , i'll check this out and say my opinion on it .
thanx again
ryuuka
Forum Contributor
Posts: 128
Joined: Tue Sep 05, 2006 8:18 am
Location: the netherlands

Post by ryuuka »

working with php in the command line essentially works like this:

C:\php\php.exe D:\scripts\php-script\thingy.php

first you you give the path to the php executable and then you give the path to the php script.

that's how i do it at least
User avatar
dude81
Forum Regular
Posts: 509
Joined: Mon Aug 29, 2005 6:26 am
Location: Pearls City

Post by dude81 »

Search for PHP STDIN, that could be of help. One such link here
STDIN
Post Reply