Calling captcha script from IMG tag

Hey, I’m trying to implement a captcha script (from, but I don’t think that the script is actually executing.

The script is being called from a straight HTML block as:

img src=“CaptchaSecurityImages.php” alt=“wtf”

and “wtf” is showing up on the page.

I added echo statements in CaptchaSecurityImages.php and they aren’t showing up on the page or in view page source either

this is the page, if anyone wantys to view page source.

both php scripts are in the root directory

It looks like your actual script is broken. You should be able to browse directly to and see an example image, but you get a load of error message goodness instead. It is impossible for me to view the actual PHP, but it looks like “going to function” is being output to the browser (which will break the script). You’ll need to remove “back from function” as well.

Max discount on any plan with promocode SCJESSEYTOTAL

This might help…

going to function Warning: Cannot modify header information - headers already sent by (output started at /home/.janeane/coolgeek/ in /home/.janeane/coolgeek/ on line 66 Check to make sure you have absolutely no white space outside of your <?php ?> tags. No spaces, no tabs, no blank lines. I learned (the hard way, of course) this can cause the above error.

Hope this helps, it is the only thing I can think of at the moment.


Thanks scjessey (and, on preview, Rudy).

Didn’t think to try hitting the script directly…

I removed the echo statements and it is indeed working correctly now.

However, I was originally keeping the Captcha script in an include directory, outside document root, with all of my php require files:

img src="…/devinclude/CaptchaSecurityImages.php" alt=“wtf”

and that is still failing, showing the alt text

Is Apache not allowing this because it’s outside of the document root? Is there a way around this?


include("devinclude/CaptchaSecurityImages.php");I probably have a typo in the suggested path…
While the web browser can not go outside the web document root, php can.


As long as the script is somewhere in your web folder (or some sub folder therein) you should have no problem. Just make sure everything is in the same place though (like the font file, etc.).

Max discount on any plan with promocode SCJESSEYTOTAL

okay, I put it back in doc root.

thanks all

Here is the captcha that I made, and it works really nicely.