Re: How do you get CGI happening?
- Posted by Frank Dowling <frank at fra?kied?com> Jan 23, 2008
- 659 views
Craig Welch wrote: > > I read that many times. I am not smart enough to understand it. > > In that case, I am not smart enough to help you. > > Sorry. There is some documentation on the internet about this. I would recommend searching the mailing list archive for "CGI" problems. I had the same problem as you, I tried off and on for ages to get euphoria working through CGI. I changed everything around so much I recognize in retrospect I got 99% of this right everytime but also I missed one directive everytime too. Please realise before you get frustrated with euphoria that it is *worth* investing time learning the concept of CGI programming in general - it will help with whatever language you end up using to do CGI. To do any CGI you have to have a webserver, basically. It's easiest if you use Apache for this because it's the dominant server and there is more documentation for this than any other at present (due to its cultural lineage).authoritave I'm making a presumption you are using Windows here. Install Apache as normal, using the default options. This should add "Apache" to your "Start Menu" programs. Under "Apache HTTP Server ......" You will find "Configure Apache Server", on which click "Edit Apache httpd.conf...." This is a file you're going to have to get used to. Apache is generally configured by a text configuration file, rather than tabbed dialog windows like most programs. It's easier if you just bite the bullet and experiment. I would save the original file as a backup somewhere, and go nuts with the following (you can always revert to the saved version - don't delete it!) First, read the website http://www.cklester.com/euphoria/?page=apache - this is the most authorative website I have seen on this issue. Don't worry if parts of it go over your head, just do it all step by step, and experiment ( I cannot stress enough - back-up the original httpd.conf ). These are the first things I do when setting up Euphoria for CGI on a new computer *) First things first, you need apache to be working - hit your ip address in your web browser, and it should give you a page that informs you Apache is working. If it is not working, there's no point even contemplating CGI - you'll need a webserver. If it doesn't work "out of the box" then you'll need to take this to an Apache specific group. Apache must work first and foremost *) Create a shorcut to Apache Error log file on your desktop or whatever folder is easiest for you. Go to the Start Menu, to Apache, then Review Server Log Files, then "Review Error Log". Left click on it, move it over your desktop or whereever is a convenient folder to have the link, and hold down the ALT key before you let go (this creates a shortcut, rather than moving the menu item). You'll need it. *) Through the start menu (you might want to create a shortcut for this too), edit httpd.conf for the following lines: the easiest way is to copy these and "search" for them in the text file Find the line "LoadModule cgi_module modules/mod_cgi.so" - make sure it does not have the character '#' at the start of the line. It should look like this LoadModule cgi_module modules/mod_cgi.so not this #LoadModule cgi_module modules/mod_cgi.so Go through the steps as detailed on CK Lesters website A good way to test whether Euphoria is working or not as a CGI implementation is to create a file in your web directory which is "Euphoric" (following what the CK Lester website documents, ends in exw,exu, etcetera) Hit it. If it says "Internal Server Error" then you are away laughinng. Euphoria is working with CGI, you just need to move onto the next step which is simple - the first line of every "euphoria cgi file" should be a "shebang" line - a # followed by the path to the Euphoria interpreter. for now just put the full windows path Secondly, the second line of each file should be this : puts(1,"content-type:text/html\n\n") Then put something like this or whatever: puts(1,"Hello World!") It can get a lot more complicated than this, but you'd be moving onto the world of the world wide web, rather than specific Euphoria example problems. I'm sorry it sounds so complicated, but you'd have to cover half of this to really even get anywhere with PHP, which is *substantially* more complex and slower than Euphoria. On a final note, with Apache every directory is allowed to be defined privelages - in Linux you can define some of these through the Operating System itself - but you can also define these in a file also. You can control a whole lot of shit through the .htaccess file, but you should not need to deal with it certainly not before you've mastered simple euphoria programs. Cheers Frank Too close to Antacrtica, New Zealand > > > Does your ISP allow you to install Euphoria? To modify .htaccess so that > > > Euphoria > > > will be recognised as a program to execute CGI? > > > > Who is .htaccess? > > <a > href="http://en.wikipedia.org/wiki/.htaccess">http://en.wikipedia.org/wiki/.htaccess</a>. > Not > sure why I'm doing your homework for you. You say you've just installed > Apache, but you haven't (for > some reason) read its documentation? > > Oops. Smacks own wrist. > > Reminds self not to respond to troll. > > -- > Craig > Euphoria friendly webhosting: <a > href="http://www.wazu.jp/hosting/euphoria.html">http://www.wazu.jp/hosting/euphoria.html</a>