Welcome to one very strangely named page. ;-) I figured
that since you drop me some rather interesting and often
challenging questions, I should share them with the world. Don't
worry, the URLs have been changed to protect the innocent.
It is my hope that by sharing these letters with you in Q&A
format, that you might find an idea, or an inspiration. The
letters on this page will primarily focus on CGI and server related issues,
but as time permits I will start similar pages for other topics
as well.
No typos are corrected.
Q:
From Lorin...
This is a great site, but despite being "dumbed down" for beginners
I *still* have a couple of questions...
What's the difference between the URL for my cgi script and the
UNIX path to my cgi bin?
It's really the second bit I don't get...is it just part of the
FTP protocol for uploading to the server?
Thanks for fielding my questions and also for building a
useful resource for those of us still on the trailing edge of the
learning curve.
A:
Thanks so much for visiting and leaving your kind words.
To answer your question: The URL would be like:
http://www.place.com/cgi-bin/script.cgi
The unix path might be something like:
/usr/dom/xplace/cgi-bin/script.cgi
Think of the unix path as being, well a regular file name on a hard disk,
and the URL as what you would enter in the command window of your browser,
or enter as a link.
Q:
From Janos...
Thanx for your reply. I copied an other cgi script and that worked. I
compared the two, and now I know what the problem was. At the first
line, there was a cartridge-back character of some kind, an underlined
letter "M". I deleted it, and it started moving! :))
A:
Glad to hear you got it working! The ^M is the carriage return
character. When you FTP a text file from a DOS/WIN PC to UNIX you
must transfer the file using ASCII, not BINARY. The ASCII mode
strips off the ^M's from the end of each line. Most unix systems
choke on the ^M.
Q:
From Peter...
Do you take steps to insure that the scripts you shareware virus free?
Aside from the big business people and elitists who want to
overregulate the Net, the Virus hackers are the ones
scaring off more people. Oh well. Keep up the good fight!
A:
Virii? Okay. I scan all exe and zip files before uploading.
Unix Cgi scripts can't contain virii. Unix doesn't work
like DOS. HOWEVER!!!! They CAN contain trojan horses and
time bombs. If you notice, I have warnings on my cgi script
archive page advising people to make backups, etc....
Q:
From Russell...
That's a cute story how you came up with a name for your site. I have a
little one on the way. I tried using the java script you suppied for
playing music. It works when I pull my page up on my PC but not when I
try from my service provider. I believe it's a UNIX OS. My ISP
directory containes a java directory, but I can't seem to
access it to see its contents. Can you help?
A:
Actually, it sounds like the MIME type for midi is not installed in your
directory. Please check with your ISP on how to add a MIME type to your
.htaccess file. The entry should read:
AddType audio/x-midi mid
Q:
From Chris...
I don't understand how or where to issue the
command to properly set the permissions. chmod 755 myscript.cgi
A:
Assuming you are on a unix server and using WS-FTP, high light
the file on the server side of the screen, then right-click.
A menu will appear showing a choice Unix Chmod. You the click
on that and select the boxes for owner- read write execute
group- read execute others- read execute.
Also, be sure that you uploaded the file as ASCII, not binary.
If you are using a different FTP client, use their help screen
and search for chmod or permissions.
Q:
From Dana...
Bless you!! :)
I'm a "CGI Idiot" who has been struggling with a form processor for a week now.. I've been thru all the faq's I could find, read tons of scripts, yadayada.. couldn't figure out why my program didn't work until I saw in wonderful bold text on your cgi page "transfer as ASCII not binary"
DUH! :) works great now!!! Thank you! Thank you!
A:
Again, I can't stress strongly enough how important it is to upload
non-binary files such as scripts and text files as ASCII and not
binary...
Q:
From Shary...
I would like to add sound to my site, I read your info on adding it.
I want to add my music to my site.
How do I get from a CD to a midi file?
A:
A CD music recording is very different from a MIDI file. A MIDI
file works much like a multitrack tape recorder to control different
channels on a synthesizer. A CD music recording is a digitial
representation of analog (what we listen to) sound. A utility that
could do what you ask would have to somehow pick out each individual
instrument. I have heard of work in this area, but have not seen
too much on it.
Q:
From Hillary...
I have been searching for information on how to create a site, or several different (but the same) versions of one site, so I don't limit myself to one or two browsers. Is there a html tag I can put in that will allow the viewer to see the best possible rendering of the site on their browser? Or how do I compile different versions of the same site on one site...am I making any sense? I have always been good at rambling!
Any wisdom you can impart will be welcomed!
A:
Although there is a way using javascript to find the type of browser
and then go to another page as you describe, I would like to impart
some wisdom by advising against it! There are already several different
browsers around, each with several different versions. Further more,
new updates are coming out all the time, each with their own bug,
quirks, and enhancements. If you try and make things perfect for each,
you will have no time to develop your content. ;-)
Q:
From Jason...
I am trying to setup a page that is password protected. I followed the instructions on your page. However my errors is that can't find the command at all. I did alot of things but won't located such a command. I am using a Solaris Unix based machine. I like to setup a page like that but I am having trouble. I made the file .htaccess in the directory where I want the page. But when I run the htpasswd command it can't find that command. I don't knwo what else to try. I don't know if that command is on this system at all. Let me know. Thanks.
A:
If your system administrator did not put the htpasswd program in your
search path, or where your shell automatically goes to look for programs,
you can use the find command:
find / -name htpasswd -print
You may get a bunch of "no permission" errors, and it may take a while
to run. It will eventually give you the answer if it is there. To run
the program you will have to type the path as well as the program name,
i.e., /usr/local/etc/httpd/helpers/htpasswd
Q:
From Jawn...
Hi, first I would like to comment on your excellent (yet admittedly oddly named) site. I have a questions regarding SSI. I am currently attempting to install a SSI rotating banner script and I have a perl Script, and I am wondering where you are supposed to put the "print "content-type: text/html\n\n" ". do I put it at the begining of the PERL file, and if so, do I put it before or after the #/bin... command? Thank you very much for your time.
A:
The print "Content-type: text/html\n\n"; has to appear before any other
print or output type of command. The #!/path_to_perl, such as #!/usr/local/bin/perl must be the very first line at the top of the script.
Q:
From Tina...
Hi there:
Your page is wonderful and very well written. Best page I have seen trying to learn about cgi and perl. I have one question. When you say type perl.... How do you do that?
I have a cgi-bin on my server but I don't know where to type that command, or did I misunderstand something?
A:
This reminds me of when a program prompts somebody to "press any key"
and the person tries to find the ANY key on the keyboard...
TYPE is a unix command that will help you find a file. You
can also use the more common WHICH command. At your prompt:
$ which perl
might respond with /usr/local/bin/perl
Same thing for type perl
Q:
From David...
On the "Tools of the Trade" page, the first program listed was "AXS" By Fluid Dynamics and a link to Fluid Dynamics. I clicked on it and the site is renovating so I can't download the program. I was wondering if you could E-MAIL the program to me. I would be very thankful! Have a nice day!
A:
They boys have a very strange sense of humor. The site is in fact
very much open. ;-)
Q:
From Konrad...
could you tell me where may I download cgi-bin for my server?
A:
CGI-BIN is not something you download. It is a part of the web
or http server. In order to use cgi-bin, the server must be
configured so that it is enabled, and you must have permission
to use it. Please check with your system administrator.
Q:
From Michael...
Your virtual post card scrip is great.
'd like to use your scrip on my site to offer my visitors can send ther virtual flower arrangement post card ( I'd like to call this as virtual flowers) for FREE.
Is this ok ?
Please advice.
A:
Do you have the script up and running? If so, congrats. Thanks
so much for liking it. You are free to use the script as you
please for whatever purpose you want. That is why I created it.
Enjoy!
Q & A
From Leon...
I have a virtual server with a cgi-bin directory, does this indicate I have complete autonomy to run cgi programs from that directory?
I would assume so. Make certain that you properly call your scripts using
the right URL, i.e., /cgi-bin/script.cgi
Also, with a virtual server can I set permissions or does the server owner have to be consulted?
If you have the ability to place your scripts in your cgi-bin directory,
it is your job to set the permissions. If you are using FTP, see the
help file for your program about using the Unix CHMOD command.
Also on my ftp client I often click "auto" upload for transfer of files is this a good practice or should I do manual uploads of files?
This can create many problems if you do not have your FTP programs
default file types set up properly. GIF, MID & JPG for instance
must always be sent as BINARY. CGI, PL, TXT, HTML & and such
must be uploaded as ASCII.
By the way what happes to files uploaded under the wrong protocol ( broken images is a wide spread problem)?
You are correct. An image file sent as ASCII will most likely be
seriously toasted. Most FTP default settings are pretty smart about
GIF and JPG though. If you manually select ASCII, well....
Q:
From Kevin...
Question = I have a question. I admit I haven't been studying scripting and such for long, so please excuse my ignorance.
The way I understand it, a SCRIPT command in HTML calls a program that can be located in another file and be written in just about any programming language. Could the program that the script calls do something besides these nice forms and such? Specifically, could that program act as an interface to another program?
For example: my office has a computerized HVAC system. If that system was connected to the net and some programs, would it be possible to get on the internet at my house in the morning and ask the HVAC system at work to warm up my office some? It could use a form (requested temp, current temp, password, ect.) to act as the information buffer.
I'm not a programer, but I have these ideas sometimes.
A:
Ahhhhh. Now you are thinking! You can do whatever you want from the
web. Here is the idea.
The program- or a script to call it must reside in your cgi-bin
directory.
The script can call ANY program and pass whatever arguments you
want.
When you POST a form, the CONTENT_LENGTH part of it that gets
decoded is really the equivalent of what is called the STANDARD
INPUT. In otherwords, you typing from the keyboard.
The STANDARD OUTPUT is then redirected back to the web.
If you get back that output and preface it with
print "Content-type: text/html\n\n";
print "<HTML><PRE>\n";
You get the output on your browser!
You do not have to use perl, BUT it is easier to work with than
/bin/sh. You can use c, but will need a handy decoder lib function.
Q:
From Davey...
Real quick, could you let me know what all the various chmod numbers
mean?
A:
For Files
777 rwxrwxrwx all can read/write/exec
755 rwxr-xr-x owner can do all, group/others can read/exec
666 rw-rw-rw- all can read/write
644 rw-r--r-- ownder can read/write, group/others can just read
For Directories (the x means search, not execute)
777 drwxrwxrwx (means all can read, write, search)
755 drwxr-xr-x owner can do all, others and group just search,read
typical settings....
cgi scripts 755
data files 666
configuration files 644 (not updated by scripts)
directories 777 with proper permissions on files in directory.
Q:
From Austin...
First of all great site! I just have a question. I was reading your SSI section, and I want to develop my site to have a side navigation bar, but I want to update it just once, and not have to go through every page to update it.
I found your page helpful, and found out I could use the include statement. But is there anyway to do this without having to rename your page to .shtml? I did not understand the CGI way of doing it, is it easy and
I am just missing something? I would appreciate any help you would care to give me!
A:
Thanks for visiting and for your kind words. Yeah, the shtml name is
required by most servers. The reason has to do with performance. A
file that ends with shtml tells the server that it has to be scanned
for commands before being sent to the browser. You could check with
your system administrator on that.
To do a side navigation bar on each page is not hard at all. Basically
you stick your WHOLE page in a table. Be certain that EVERY image has
a HEIGHT and WIDTH attribute, otherwise Netscape requires the entire
page to be downloaded images and all before displaying anything. Here
is the idea.
<TABLE WIDTH=580>
<TR>
<TD WIDTH=200>
<!--#include file="menu1.txt" -->
</TD>
<TD>
STICK ENTIRE RIGHT HAND SIDE OF PAGE IN THIS CELL!
</TD>
</TR>
</TABLE>
That will do exactly what you are trying to do. Any change you
make to menu1.txt will affect all pages containing. VERY low
maintenence. ;-) I hope that helps you out.
Q:
From Heather...
I've been looking everywhere on how to make a robots.txt file, and what to include. No one can tell me. Can you?
A:
Thanks so much for your kind words!
Here is mine. It tells all obedient spiders (haha) to stay away
from the following files and directories on my site. The file
should be placed in your main web documents directory.
From Vickie...
Hi! I love your site - and cute name. I cracked up (at the
name) when I ran across your "Bird Droppings!" This is probably a
simply, silly question, but my plight is as follows...
I have seen many sites that make reference to the graphics that they are
using as a path:
"/images/example.gif"
and you did so in your formatting help area:
<IMG SRC="/graphics/bullets/40-99-20.gif">
I have tried to use this style instead of just stating the graphic name
without a path and keep getting a crashed graphic. For example, if
my graphic was named abc.gif and I wrote:
<img src="/images/abc.gif">
Where do I create a directory so when the page loads, it knows to get
abc.gif from the "images" directory? I tried making a directory called
images under my public_html directory and it doesn't work?
Anyway, I have looked high and low for my answer to no avail.
I loved the way you wrote simply, yet complete and direct answers to the
people who posed questions. Any simply answers for me?
I would be ever-so-grateful!
Thanks a bunch!
Vickie
A:
Hi Vickie,
Okay, the reason you are having this problem is that your
public_html directory is not at the highest level of the
system. Try this....
Assuming you have made an "images" directory:
<IMG SRC="./images/test.gif>
Notice the "." before the /images This is called relative
addressing vs absolute addressing. I Must be in a big words
mood tonight!
Thanks!
Bruce