<-- back to the mailing list

Trying to learn CGI, please help, total newbie lost

Omar Polo 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
```
#!/usr/bin/ruby
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" youshould put a media type there, like text/gemini. Also, the \n and \rare in the wrong order, \r comes first. (puts should add a \n by itselfat the end, so `puts "20 text/gemini\r"` should be enough).

Then make sure /usr/bin/ruby is the correct path for you rubyinterpreter (you can type `which ruby` to check, or use `/usr/bin/envruby` which is "portable enough" across various UNIXes).

In the end, make sure it has the executable bit set (i.e. `chmod +xyour-cgi-script`). Different gemini servers MAY impose limits on whereyou store your scripts (i.e. under /cgi-bin/ or similar).

If it's nothing in the above list, then it's something you should informctrl-c.club about (maybe they don't allow scripts?)

HTH

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