Text Editors You Can Use To Create CGI Scripts
Why does it matter?
When editing or creating a script to use on your CGI server, sometimes it
does matter what text editor you use. Some scripts need to be saved in
Unix file format which uses a single line feed character at the end
of each line. Some examples are .htaccess files, and scripts created
using Perl, Python, Ruby, and others. The only exception are PHP scripts. Saving
scripts in the wrong format may cause an Internal Server Error 500 when
you try to run your script. When editing a script, you usually can not see the
characters that are put at the end of each line automatically by the text editor
when the file is saved. If you are testing scripts on your own server before
uploading them, please keep this in mind.
What editors should I use?
Word Processors such as MicroSoft Word, OpenOffice Write, Word Pad and Windows
Write should never be used for editing or creating scripts, including PHP scripts.
They often add special codes to the documents which can render a script inoperable.
Any text editor which saves to Windows text format should not be used to save
script files, unless you can save the file to Unix text format. These include
NotePad, which is included in nearly every Windows installation. Some Linux
editors such as Quanta and Kate save to Windows text format by default. These
programs typically add a combination of a carriage return and line feed character
at the end of every line. This combination can render the script inoperable.
However, you can use these editors for creating or editing PHP scripts.
If the text editor does not let you choose which format to save in, it will
save in the same format the operating system uses. There are many text editors
available that can save using both the Windows and Unix text format. You will
need to consult the text editor documentation to learn how to save files in the
proper format. Here are a few Windows text editors that allow you to save in
Unix text format:
Other problems which can cause errors:
Before you run your script, be sure to change your file permissions (chmod) to
755 after you upload the script to your CGI server.
For more information, please see
Error 500: 'Internal Server Error' When Running CGI or Perl Scripts.