davidj01 has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I wrote a perl script to create a captcha.

Its called from a HTML img tag: <img src="/cgi-bin/createcaptcha.cgi" width="70" height="30" border="1">

Its use GD and MySQL.

It works but repeated use for some of the calls times out.

In the error log I get this:

Fri Aug 01 11:48:52 2008 warn Timeout waiting for output from CGI script
/var/www/website/cgi-bin/createcaptcha.cgi
Fri Aug 01 11:48:52 2008 error (70007)The timeout specified has expired: ap_content_length_filter: apr_bucket_read() failed

I googled and I couldn't find a solution

Anyone else had this problem and if so how did your resolve it.

Thanks
David J.
  • Comment on Timeout waiting for output from CGI script

Replies are listed 'Best First'.
Re: Timeout waiting for output from CGI script
by hangon (Deacon) on Aug 01, 2008 at 20:36 UTC

    You might want to take a look at Captcha::reCaptcha. Its well documented and easy to use. It uses captcha images served from http://recaptcha.net, so you don't have to generate them on your own server.

Re: Timeout waiting for output from CGI script
by psini (Deacon) on Aug 01, 2008 at 16:40 UTC

    My best guess is that your script goes into an endless loop under some circumstances, but it is difficult to say without seeing the source.

    Rule One: "Do not act incautiously when confronting a little bald wrinkly smiling man."

      Hi,

      Thanks for all 3 answers they were all good.

      Eventually I did find an infinite loop and a misplacement of setting the seed to the rand function.

      Once resolved it works flawlessly.

      Thank-you
      David J
Re: Timeout waiting for output from CGI script
by InfiniteSilence (Curate) on Aug 01, 2008 at 16:41 UTC
    Create a script to produce one hundred thousand of these things with random names and store them on your server in a subdirectory of your images folder. Rewrite your script to select one of those images, issue it to the user, and delete it when you are done. If you run out, have the script e-mail and try to manually produce the captcha for the user.

    Celebrate Intellectual Diversity