Hello all,
I just got done with a
5 hour debug stretch trying to get the CAPTCHA image to appear during the user registration process. I finally got it to work so I want to share some of what I learned while it is still fresh in my mind.
If a CAPTCHA image does not appear during the registration process
it is most likely because the open source GD library is not installed or configured properly on your system. If you have
Zend Studio installed, and you see debug notifications that
ImageFontHeight() and
ImageFontWidth() are undefined functions, it is because the GD extension DLL is not loaded and those symbols have not been resolved.
I like to run a complete install of Pligg on my local
Windows 2000 box with "
localhost" as my base URL. I went through hell getting image verification to work and here are some tips.
Make sure you are running
PHP 4.4.4 or greater. This version has GD bundled with it. If this your case, follow the instructions on the URL below (
ZEND USERS SHOULD READ THIS WHOLE POST):
Around the middle of that FAQ page you'll see the very simple instructions on how to enable the bundled GD 2 DLL. Follow the instructions.
NOTE: Run phpinfo.php to find out the true full path to your PHP.INI file; or you may waste a lot of time chasing down the wrong PHP.INI file. They seem to multiply like rabbits. You'll see the full path to the PHP.INI file that was loaded at the top of the phpinfo.php dump.
Linux users may have to go through some extra hoops, perhaps recompiling PHP with GD support and making sure certain graphics libraries are installed. Windows users should not have to compile anything at all.
THE BIG KICKER FOR SOME ZEND USERS
Ok. So I did all of the above and still GD would not load no matter what I did! I was really going crazy at this point. No matter what I did, when I debugged in Zend,
GD never showed up in the module list when I executed phpinfo.php.
Then I found the problem.
I have Zend's
WinEnabler package installed on my system. WinEnabler is a replacement DLL for the PHP DLL that usually loads with Apache called
php4apache.dll. It's a lot faster and more stable which is why they recommend you install it.
But here's the problem.
It doesn't seem to respect PHP.INI or at least, it doesn't know how to load extensions like GD properly. I went back to an old HTTD.CONF, and used php4apache.dll instead:
Quote:
|
LoadModule php4_module c:/PHP/sapi/php4apache.dll
|
Bingo!
GD showed up in the phpinfo.php dump and in Pligg during the CAPTCHA verifcation used in registration. NOTE: If the WinEnabler problem applies to you,
SAVE your existing HTTD.CONF before trying to revert to php4apache.dll! You may also need to copy
php4ts.dll into a directory on your system path. I copied it into C:\WINNT. You can find it in the directory that you installed PHP in.
If you are running Zend WinEnabler on a live Windows server then I don't know what to tell you except to beat on Zend technical support for the exact instructions to get GD working with Zend and Apache. For a live public server it's just not worth it to go back to php4apache.dll, the stock setup. I'm running locally for testing so I don't care.
Good luck! I need a nap.