script problem.

Discussion in 'Web Design and Development' started by sbryan, Oct 22, 2008.

  1. sbryan macrumors member

    Jun 6, 2007
    I downloaded this formmail script and I'm having trouble configuring it.

    I don't have a sendmail application installed on the server, but the Readme says I can configure it for SMTP use, and that's how I'm trying to use it.

    The files mirror the hierarchy shown in the Examples.txt: main pearl script in the cgi-bin folder, other files in a supporting directory called tfmail.

    The form I created using Dreamweaver is pointed to the correct file, method: post, enctype: text/plain.

    When I try to submit the form, I get this response from the browser:

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

    Here is what the server error log shows for the same event:

    [2008-10-22 06:31:46]: error: file has no execute permission: (/home/public_html/cgi-bin/

    I looked into this issues specifically and made the suggested changes:
    1. 755 Permissions on the cgi-bin folder
    2. 755 Permissions on the .htaccess file
    3. 755 permission on the tfmail folder which contains supporting files and formatted templates for output

    I've been troubleshooting this for over two weeks and I'm really hoping you guys can help! I could pay the host company $50 to install it, but I'm still not convinced it isn't a problem with their default settings or security settings.

    Thank you,
  2. SrWebDeveloper macrumors 68000


    Dec 7, 2007
    Alexandria, VA, USA
    It's good that you're checking the server error log - continue to look there as you work through these remaining issues:

    1) There is no .htaccess in the zip you included - you need to tell me what's in there, exactly, and why its there at all

    2) The correct absolute path is:


    To load the script use "/cgi-bin/tfmail/" as the path along with any other arguments.

    I say this because you told me you chmod that folder to 755, and the zip contains the folder as well with all related files inside. Your server error log is telling you that you didn't include the tfmail folder.

    3) The zip file you sent is NOT the configured version for your setup, but the default configuration. You need to read the README file and follow directions for complete configuration including SMTP setup. If you need further help, use the code tag and import and default.trc so we can see what you did, plus include any error msg's from the server error log.

  3. angelwatt Moderator emeritus


    Aug 16, 2005
    Make sure the individual script file also has the right permissions, not just the containing folder.
  4. sbryan thread starter macrumors member

    Jun 6, 2007
    1. The .htaccess file is empty, however somebody suggested I look into the entries and permissions. It is the default .htaccess file provided by the host.

    2. I've tried using absolute paths and the shortened paths and neither seem to work.

    3. I've edited the .pl script for my use as instructed by the Readme.

    Also, the permissions look good at the folder and file level.

    Here's the most recent errors in the server log:

    [Wed Oct 22 10:03:58 2008] [error] [client] File does not exist: /home/infotheg/public_html/404.shtml
    [Wed Oct 22 10:03:58 2008] [error] [client] File does not exist: /home/infotheg/public_html/favicon.ico
    [Wed Oct 22 06:31:46 2008] [error] [client] File does not exist: /home/infotheg/public_html/500.shtml
    [Wed Oct 22 06:31:46 2008] [error] [client] Premature end of script headers: /home/infotheg/public_html/cgi-bin/
    [Wed Oct 22 06:31:04 2008] [error] [client] File does not exist: /home/infotheg/public_html/404.shtml
    [Wed Oct 22 06:31:04 2008] [error] [client] File does not exist: /home/infotheg/public_html/favicon.ico

  5. sbryan thread starter macrumors member

    Jun 6, 2007
    Also, I don't mean to give the impression that I have my heart set on this specific script.

    I just need a script that turns form results into an e-mail that can be formatted with bold text and perhaps a company logo.

    So if you are tempted to suggest another script that can do the same thing, don't hold back.

  6. SrWebDeveloper macrumors 68000


    Dec 7, 2007
    Alexandria, VA, USA
    Got a case of split personality here, I see two paths from you:


    I'm going to assume the following:

    1) The first path above is correct
    2) You did not upload the tfmail folder, you simply uploaded all the files contained within it to
    3) You correctly chmod all the executable files to 755
    4) You read the instructions and configured the correct files and created the proper HTML form since this is a formmail type of script.

    So that means:

    1) Via command line (telnet or ssh into your server) you could type in:
    cd /home/infotheg/public_html/cgi-bin

    That will run the script via command line, and if it works properly no errors and you will see HTML. Try it. What do you see?

    Now let me explain "premature end of script headers". That means the HTTP headers are incomplete. It is the responsibility of the script to include this line before anything else is printed...
    print "Content-type: text/html\n\n";
    ...which is the Perl command that creates the content type header. If this does not occur, the output will not be sent to the browser, which made the request, and the web server generates the error. You will ONLY see this error when running the script via browser. This will occur if you insert a blank line, space or try to print anything else BEFORE that line in the code.

    Now it's possible the script doesn't work - i.e. it's buggy and the developer who wrote it screwed that part up. But, I doubt it.

    So double check paths, permissions and configuration, then test it locally on the server. Otherwise use the code command here and copy/paste the following

    2) Your relevant HTML so I can see the action you're using to call this perl script


  7. SrWebDeveloper macrumors 68000


    Dec 7, 2007
    Alexandria, VA, USA
    In terms of another script, all the Perl ones will be similar in nature. Beyond that, if your server supports PHP then:

    Highly recommended, great documentation and security vulnerabilities minimal.

  8. sbryan thread starter macrumors member

    Jun 6, 2007
    The server supports PHP and the script Tectite offers looks much more secure. I went ahead and paid the $8 for the pre-configured script. I need to do some troubleshooting with Tectite, but I think this problem will be resolved by the weekend.

  9. SrWebDeveloper macrumors 68000


    Dec 7, 2007
    Alexandria, VA, USA
    My pleasure - this is the kind of tech support I did back in 1990's (and older gurus here might go back even further) when Perl was commonly used for things like this including guest books and hit counters called via SSI, etc. So anyone following this might appreciate how far we've come - PHP is drop in place and (when developed properly) is very secure as well for forms processing and E-Mail. Perl is still commonly found and used on the *nix platform for all kinds of important tasks and anyone who web develops would benefit from knowing how to install and debug basic Perl stuff.

    So long as paths, permissions and your action in your form tag is right - the folks who are helping you now can focus on the script itself and you'll be up and running in no time, I am sure.

    Feel free to post any questions here, of course.


Share This Page