Reply to Re: Running PHP via CLI

Your name:

Reply:


Posted by Norman Peelman on 12/06/07 11:30

Kim wrote:
> I made a php script with a HTML form (POST) which takes many options
> and based on the options, it connects to a database file and create
> some files from the results. This works fine when using a browser.
>
> Now, I am being asked if it can run via CLI. My first reaction was
> "no", but that was before I even had looked into the matter.
> Running via CLI is preferred instead of having to install a webserver
> solution like WAMP. Also, the target machine which should run the PHP
> script is a standalone (no network of any kind).
>
> After reading some about PHP in CLI mode, and experiments have I come
> to this conclusion:
> * php.exe does not support GET, POST or HTML codes (it will displayed
> as raw text)
> * php-cgi.exe does support GET but still not POST or HTML codes.
> This means you can parse parameters to your php script, like: <php-cgi
> path> -n -f <php script> para1=value1 para2=value2 etc. Full access to
> $_GET.
>
> I still have not found a way to run this script via CLI.
>
> Do I need to re-write the whole thing specially for CLI mode ?
> Is there another way to parse parameters via CLI mode ?


Running PHP from the command line (terminal window) requires that you
use php.cli (not php.cgi or php.exe). Well, it doesn't require it but
the point is that you cannot use the standard HTML FORMS for your input
and output. Please follow this link and read the whole page...

http://us.php.net/manual/en/features.commandline.php


---
Norm

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация