General discussion

Locked

CGI in PHP

By davoud ·
Hi,

I am looking for an online tutorial on how to write CGI scripts using PHP language. There are some tutorials on the net on how to write CGI scripts in PERL but nothing about CGI in PHP.

I would greatly appreciate if you could provide me with a link or a book name on this please.

Thanks

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Well basically you wouldn't

by Tony Hopkinson In reply to CGI in PHP

PHP scripts are generally executed by a web server the mechanisms for inputting requests and returning responses are internal. CGI is external to a web server. The web server passes the request to it and receives the response back. I suppose you could write a php based cgi but I fail to see the point.
The reason to use CGI is that you can use a much more powerful language (such as perl, C++, ObjectPascal ...) to process the request than whatever internal one(s) are provided by the web server.

Collapse -

by davoud In reply to Well basically you would ...

Thanks very much for your comments. As a newbie, I have learnt HTML and would like to continue learning PHP, MYSQL and soforth.

As I see the samples, learning PHP is easier than leraning PERL.

What I am trying to accomplish is to wite a CGI script using PHP to process inputs ,for instance, of a form on a webpage. I understand that this can be done using PERL but learning PERL will be a hard way for me to go.

What is your opinion about all of this?

thanks for your time.

Collapse -

I've only used Perl

by Tony Hopkinson In reply to

to write administration scripts, never done CGI with it. Perl is not that difficult, your problem might be you are finding advanced examples. Perl can go from so simple you wondered why they bothered to requiring three extra brains and an advanced doctorate in boffinry to get your head round it. I still don't get regular expressions intuitively even though I do use them.

You can use PHP to process a form, it's not that difficult to get your head round, google will give you several examples. Once you've learnt how to do it in PHP, the perl code may become less opaque.

Try this link I found it useful to find out how to do things in PHP.
http://codewalkers.com/code.php

Collapse -

php

by Jaqui In reply to

is effectively cgi to begin with.

you have the same requirement of formatting output from php into a browser compatable format as with any cgi script.

check the downloads for php here on tr, there are a number of usefull script collections, for parsing forms and formatting results.

Collapse -

by davoud In reply to php

Thanks alot for taking your time to reply to my post. Tony Hopkinson, the link that you provided is wonderfull. Thanks so much, I will go through it shortly. Jaqui, thanks for the suggestion, I will look for the scipts up here.

best wishes

Back to Web Development Forum
5 total posts (Page 1 of 1)  

Related Discussions

Related Forums