Page 1 of 3
CGI Survival Guide
Posted: Mon Dec 07, 2009 4:50 pm
by blueznl
Well, okay, let's try it then. Should I post the questions here or in another part of the forum? If it's in the wrong please could some of the admin's / moderators move it please?
This thread is a reaction to:
http://www.purebasic.fr/english/viewtop ... 13&t=40196
http://www.purebasic.fr/english/viewtop ... =7&t=31517
I want to add a little page to the Survival Guide on programming for web servers, ie. CGI (and similar?) stuff. I'm a total newby on this, and know little about hosting stuff, let alone PHP (brr) HTML (ai ai) or Apache (what do helicopters have to do with hosting?) so... I need help.
It's probably best to first figure out what I have to run on a (virtual) server to test CGI stuff. I'd like to bring it to a level similar to the Survival Guide section on VirtualBox or SQL. Not too deep, just enough to get started...
http://www.xs4all.nl/~bluez/purebasic/p ... 12.htm#top
http://www.xs4all.nl/~bluez/purebasic/p ... 13.htm#top
So... what should we (hehe, see how I managed to slip that in

) cover?
Some suggestions:
- devving from home / setting up a server (VirtualBox?)
- installing Apache (or something else?)
- ...
- the rules of CGI
- doing things in PureBasic
- further remarks
Of course, I'm not interested in doing things with PHP etc. and I realise that most if it might not directly be PureBasic related, at least not at first
So, this is where I am lost

So... suggestions, help, what not?
Re: CGI Survival Guide
Posted: Tue Dec 08, 2009 11:46 am
by DoubleDutch
This is a good idea. I'also like a section with the differences between getting something working on a Windows or Linux server (with regard to CGI) - like some kind of framework that sets up access to a database, etc...
Re: CGI Survival Guide
Posted: Tue Dec 08, 2009 5:46 pm
by Fred
Would be interesting to see how far you go

Re: CGI Survival Guide
Posted: Tue Dec 08, 2009 7:57 pm
by DoubleDutch
Also please add a list of WebHosts that have been verified to let you run applications (and on which OS) without running foul of the T&C. I know DreamHost lets you (Linux based), but I don't know of any others.
Re: CGI Survival Guide
Posted: Tue Dec 08, 2009 11:55 pm
by blueznl
Well, then start by suggesting what server software I should use

Re: CGI Survival Guide
Posted: Wed Dec 09, 2009 2:33 pm
by Fred
which ? Apache !
Re: CGI Survival Guide
Posted: Wed Dec 09, 2009 5:10 pm
by blueznl
That may be the logical choice for you, but as I said, I haven't got any experience with webhosting platforms or webservers, in spite of my professional background... I'll have a look at it.
Re: CGI Survival Guide
Posted: Wed Dec 09, 2009 6:31 pm
by moogle
For server software you could use EasyPHP, it includes Apache/MySQL and is a pretty quick way to set up a home/test webserver for scripts and things

It's just like XAMP or any other software that speeds up setting a webserver up.
Re: CGI Survival Guide
Posted: Thu Dec 10, 2009 2:10 am
by citystate
Re: CGI Survival Guide
Posted: Thu Dec 10, 2009 7:19 am
by moogle
Re: CGI Survival Guide
Posted: Sat Dec 19, 2009 11:53 am
by JackWebb
blueznl wrote:That may be the logical choice for you, but as I said, I haven't got any experience with webhosting platforms or webservers, in spite of my professional background... I'll have a look at it.
Blue,
I hope I'm still on time for the CGI party. I'd be happy to share with you everything I've learned (not an expert but I do this all the time in PB).. Start with Abyss webserver (Windows). It's a very easy to use and robust production server. For developers it's great because there is a fully functioing FREE version with support via forums. The commercial version (which I have) allows you to run multiple websites on the same server. That's the only difference. But for learning how to do CGI the free version is all you need. I've even used the AtomicWebServer but it doesn't support POST methods only GET which is fine for most situations. But also has no security.
Webhosts and domain names. Most webhosts will not allow you to run .EXE files, save your money and host yourself. It will not just save you money but time since you can work locally. As far as domain names and dynamic IP addresses. Again save your money and go to no-ip.com or DynDns.com and get a free subdomain that will handle your dynamic IP. You can buy a domain name if you really want one and they will host it for your dynamic IP, (they act as your DNS) neat!
PB and CGI. Actually Pure does CGI very well. It's probably more coding than say PHP, but think of the possibilities and SPEED, low server load etc.. BTW PHP is the slowest language known to man.. And very prone to PHP hackers, I see them in my user log all the time (you will too).
I posted an example over at Aprelium.com
http://www.aprelium.com/forum/viewtopic ... highlight=
Apache.. Great webserver but you will spend more time learning Apache than CGI....
BTW, thank you for the Survival Guide!
Jack
Re: CGI Survival Guide
Posted: Sat Dec 19, 2009 4:03 pm
by blueznl
Thanks for the offer, track this space, I'll post my first questions probably in here...
I'm a little distracted with a bit of graphics at the moment, but this hasn't been forgotten, so, you're not just in time, you're even early

Re: CGI Survival Guide
Posted: Sat Dec 19, 2009 10:31 pm
by Seymour Clufley
I wrote a CGI include that handles all the communication coming in and out of a PB exe. I've been using it for ages and it also handles returning images (although I haven't tested that for a while). If it would help, I'll post it.
Re: CGI Survival Guide
Posted: Sat Dec 19, 2009 10:35 pm
by blueznl
Anything helps, but be prepared to answer questions

PureWeb Framework?
Posted: Sun Dec 20, 2009 10:00 am
by greyhoundcode
JackWebb wrote:PB and CGI. Actually Pure does CGI very well. It's probably more coding than say PHP, but think of the possibilities and SPEED, low server load etc.. BTW PHP is the slowest language known to man.. And very prone to PHP hackers, I see them in my user log all the time (you will too).
I personally am a big fan of and do a great deal of work in PHP. It's very productive, and though many a flame war has started over debates about how fast PHP is versus ASP.NET, JSP, Coldfusion and the rest, I think it's fair to say it is a "market leader" in web development. I would also suggest it is no less or more secure than PB: it is the use or lack of good programming practice that largely determines security.
However, I have no intention of starting a flame war: I too would like to use PB for CGI to take advantage of the superior speed and just because I rather like the PB syntax generally.
Getting to my point however, we all know that reinventing the wheel is to be avoided. In the world of PHP, we very often make use of frameworks which provide the structure and 'wiring' for our web apps, and take care of a range of common tasks, from sanitising request data to managing database-based sessions, generating CAPTCHAs, sticky form data, transparent connectivity with a range of databases and the list goes on.
Wouldn't it be fantastic to have a PB equivalent of one of these frameworks: and in the best traditions of web development grant an open source license so that the entire community can benefit?