PHP command lin

Problems with the Windows version of XAMPP, questions, comments, and anything related.

PHP command lin

Postby virtual » 30. August 2006 18:35

Hi, I would like to use the PHP command line, but I cant locate the correct file at the moment. Could anyone please point it to me? :oops:

Thanks,
virtual
virtual
 
Posts: 6
Joined: 11. May 2006 10:56

Postby Wiedmann » 30. August 2006 18:39

\xampp\php\php.exe
or
\xampp\php\php4\phpcli.exe
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby virtual » 07. September 2006 16:14

Whenever I open it, it always launches a cmd windows, and closes right away :(

Any ideas?
virtual
 
Posts: 6
Joined: 11. May 2006 10:56

Postby Wiedmann » 07. September 2006 16:20

Read the PHP manual how to use the CLI:
http://de.php.net/manual/en/features.commandline.php
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby virtual » 07. September 2006 16:30

Thanks. I read that before I came here, but it really didnt make any sence :/

Am I supposed to run the php-cgi.exe file, as a cmd window pops up and stays up. However, doing:

Code: Select all
$ php -r 'print("Hello");'


Doesnt work :(
virtual
 
Posts: 6
Joined: 11. May 2006 10:56

Postby Izzy » 08. September 2006 11:28

Click on Start on the Task Bar
Click on Run...
Type cmd.exe

You will see:
C:\Documents and Settings\You>

Type cd C:\xampp\xampp\php (your own path to the php directory)

You will see:
C:\xampp\xampp\php>

Type php -r print("Hello");

Next you will see:
Hello
C:\xampp\xampp\php>


Type php -?
You will see:
Code: Select all
Usage: php [options] [-f] <file> [--] [args...]
       php [options] -r <code> [--] [args...]
       php [options] [-B <begin_code>] -R <code> [-E <end_code>] [--] [args...]
       php [options] [-B <begin_code>] -F <file> [-E <end_code>] [--] [args...]
       php [options] -- [args...]
       php [options] -a

  -a               Run interactively
  -c <path>|<file> Look for php.ini file in this directory
  -n               No php.ini file will be used
  -d foo[=bar]     Define INI entry foo with value 'bar'
  -e               Generate extended information for debugger/profiler
  -f <file>        Parse <file>.
  -h               This help
  -i               PHP information
  -l               Syntax check only (lint)
  -m               Show compiled in modules
  -r <code>        Run PHP <code> without using script tags <?..?>
  -B <begin_code>  Run PHP <begin_code> before processing input lines
  -R <code>        Run PHP <code> for every input line
  -F <file>        Parse and execute <file> for every input line
  -E <end_code>    Run PHP <end_code> after processing all input lines
  -H               Hide any passed arguments from external tools.
  -s               Display colour syntax highlighted source.
  -v               Version number
  -w               Display source with stripped comments and whitespace.
  -z <file>        Load Zend extension <file>.

  args...          Arguments passed to script. Use -- args when first argument
                   starts with - or script is read from stdin

Now go from there. Re-read the manual http://php.net/manual/en/features.commandline.php and you should be heading forward on your learning curve. ;)
Good Luck.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby virtual » 08. September 2006 13:29

Fantastic. Thanks Izzy :)
virtual
 
Posts: 6
Joined: 11. May 2006 10:56


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 46 guests