Re: Vs: [PHP] PHP from command line

From: Date: Thu, 20 Jul 2000 02:24:46 +0000
Subject: Re: Vs: [PHP] PHP from command line
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-7371@lists.php.net to get a copy of this message
On Thu, 20 Jul 2000, Ville Mattila wrote: > I have a normal Windows program, written with VB etc. This program > should automaticly send a pre-formatted e-mail to given e-mail > address. I have noticed that you have to make some things harder with > VB than with PHP, one good example is sending e-mail to SMTP-server. > > So, I thought that why I couldn't pass those e-mail information to PHP > parser and then PHP will send the e-mail. I don't want to install a > web server software for this small action. So, I use the PHP.exe > -parser program directly. > > I have made a normal PHP page for this operation. Then I just run a > command "d:\php\php.exe d:\sendemail.php3" in shell. Now the PHP will > run the PHP script I made and it should send the e-mail. You could write a VB file with the text of the message, put it in a directory and then send PHP the file path this way: d:\php\php.exe d:\sendemail.php /path/to/file In your script, '/path/to/file' will be in $argv. But, this is probably as complex as just setting up PHP as a module or cgi program and using it directly. > But the problem is that how I can pass information to PHP when I'm > running it as that way? I'm looking for the way how i.e. Apache server > passes the QUERY_STRING -information to this PHP-parser? Does Apache > save the QUERY_STRING -information to a file and passes then the file > path to PHP or else??? If I knew the way how real web servers do this, > I could simulate the same way with my VB program. I think the old VB CGI method was a workaround -- writing to a file. It was the CGI-WIN interface, created by Oreilly's Website software. It was a workaround, though, not the typical way PHP, Perl and others like them worked. But none of them ran from the command line like this. They were called from the CGI bin directory, which allowed a web server execution rights to programs. Thus, the web server would be allowed to run programs that did things useful. Trying to do things from a shell prompt via an system call probably will leave you without all the environment variables you need -- content-length, query_string, etc. > Then there is another project I'm making. I have plans that I could > make own web server soft for Windows on some day. That's why I want > also some information how do web servers pass different variables > (sent via form/query-string etc etc) to the PHP and any other > CGI-parser? There is probably an RFC that helps explain this somewhere. I don't really think there is a market for web server software, however, with several popular and functional ones already widely supported. Always room for more good ones, so I won't discourage you entirely. Hans Anderson ~ me@hansanderson.com PO Box 426, Missoula, MT 59806 | PHP, Search Engines, SQL (800)397-9116 / (406)549-6524 | Databases, Flash Multimedia, http://www.hansanderson.com | Killer Audio Production, http://www.goofiness.com | Minty Fresh Breath.

« previous php.general (#7371) next »