Need help with converting cgi to php
Moderator: General Moderators
Need help with converting cgi to php
does anyone know how I can convert from this format http://www.jodeewebhosting.com/ask/index.php to this format http://www.jodee.biz/scgi-bin/rlinks/rlinks.cgi?m=index but keep it as php
your subject says from cgi to php, your message indicates the other way around?
cgi is not comparable to php, cgi is an interface for executing server side executables on the server, php is a script-engine.
normally (most cases) when processing .php files with apache, it uses a built in module, mod_php, to process the file with the php engine.
A cgi script can be any executable, and the webserver simply executes it and returns the output, executable scripts have an intepreter locator in the first line, like #!/path/to/php
So, in cas of converting a cgi to php, it depends.. if it is a php script it should be as simple as removing the first line that references the php intepreter..
Creating a cgi script from a PHP file is very simple, simply add the intepreter reference at the top of the file, rename and make the file executable.
cgi is not comparable to php, cgi is an interface for executing server side executables on the server, php is a script-engine.
normally (most cases) when processing .php files with apache, it uses a built in module, mod_php, to process the file with the php engine.
A cgi script can be any executable, and the webserver simply executes it and returns the output, executable scripts have an intepreter locator in the first line, like #!/path/to/php
So, in cas of converting a cgi to php, it depends.. if it is a php script it should be as simple as removing the first line that references the php intepreter..
Creating a cgi script from a PHP file is very simple, simply add the intepreter reference at the top of the file, rename and make the file executable.
Haha .. php IS cgi.Stoker wrote:cgi is not comparable to php, cgi is an interface for executing server side executables on the server, php is a script-engine.
Read up on what cgi actually is. It is where a request is sent to the server to be executed and then sends back the result. That is, it's run server-side. Which is php. Which is CGI.
So jminscoe, it works the same, just doesnt need to be run in a different cgi directory like the older languages like perl do.
I have read that specification a couple of times, CGI stands for Common Gateway Interface, and specifies what environment variables should be set and how the webserver sends POSTed data to STDIN of a local executable and requires a content header before returning the rest of STDOUT back to the client.lazy_yogi wrote:Read up on what cgi actually is.... it's run server-side. Which is php. Which is CGI.
PHP can of course be exeuted through a CGI interface, just as well as any other executable program or script, but PHP is not comparable.. An intepreter vs an Interface/Spec.
Clarification
I think what I should have asked is how can I make my cgi db a php db as I want to keep my link db that is cgi now but convert it to a php one as I don't like the looks of the one that is now php to I just make tables or what?