tags:

views:

48

answers:

2

I created a captcha just now, and it works PERFECTLY on my own server. On the school's server, it doesn't generate an image. Why might this be? The difference in code is one line.

Edit: Originally, it was working, but I deleted the directory by mistake and I do not know why did it suddenly work in the first place.

Update: I var_dumped() everything and everything is being set correctly. Source code on school server:

Update: I figured it out! I'll post the answer later.

+2  A: 

Make sure that GD library is enabled in your school's server.

Also try putting these lines on top of your script to see if there are any errors:

ini_set('display_errors', true);
error_reporting(E_ALL);
Sarfraz
I'm pretty sure it is, but how do I double check?
Doug
@Doug: You can check that out in extensions section in php.ini file or through phpinfo command.
Sarfraz
@Doug you don't have to check extensions section in php.ini because error messages are more reliable source of information.
Col. Shrapnel
I actually tried that earlier, but when visiting my `captchaimage.php` it only shows the url and doesn't show any errors.
Doug
I can't check phpinfo, it's restricted.
Doug
A: 

It is just useless to direct such kind of questions to SO.
There must be thousands of reasons.
And, of course, without access to your server and environment, nobody can say, just by looking into working code.

The only person who can answer this question is you yourself.
With help of your server, of course.
You must ask your server for errors.

ini_set('display_errors',1);
error_reporting(E_ALL);

but sometimes (in case of parse errors for example) this won't work. In this case you have to either set these params via .htaccess or check web-server's error log.

Also, you have to do something.
At least add some text output in the script to be sure it being executed.
print out variables using var_dump() to ensure thy contain right values. Add an intentional error to ensure you CAN see them if any. Do something, don't sit watching code!

Some more info on how to help yourself: http://www.ibm.com/developerworks/library/os-debug/

Col. Shrapnel