Trying to learn CGI, please help, total newbie lost
op at omarpolo.com
Sat Feb 13 13:21:19 GMT 2021
Miguel de Luis Espinosa <enteka at fastmail.com> writes:
> OK, so, I've never done this kind of thing before, just PHP'd websites or using sinatra (ruby) that would take care of the "small details" for you.
> So I tried this on a space I have on the ctrl-c.club tilde
> p "20 SUCCESS\n\r" # also tried puts
I don't know how ctrl-c.club works, what server they use etc. But this
(if it's not a copy-paste error) looks wrong. Instead of "SUCCESS" you
should put a media type there, like text/gemini. Also, the \n and \r
are in the wrong order, \r comes first. (puts should add a \n by itself
at the end, so `puts "20 text/gemini\r"` should be enough).
Then make sure /usr/bin/ruby is the correct path for you ruby
interpreter (you can type `which ruby` to check, or use `/usr/bin/env
ruby` which is "portable enough" across various UNIXes).
In the end, make sure it has the executable bit set (i.e. `chmod +x
your-cgi-script`). Different gemini servers MAY impose limits on where
you store your scripts (i.e. under /cgi-bin/ or similar).
If it's nothing in the above list, then it's something you should inform
ctrl-c.club about (maybe they don't allow scripts?)
> puts "# Cgi is working"
> puts "some text"
> puts "=>gemini://enteka.xyz some link"
> and it doesn't seem to work. Amphora, for one does not recognize it. I'm sure I'm doing thins wrong here
> Could that work in principle? Could I have an issue with permissions?
> Please help
More information about the Gemini