为什么这可以在我的服务器上工作,而不在我的学校上工作? [英] Why might this work on my server but not my schools?

查看:76
本文介绍了为什么这可以在我的服务器上工作,而不在我的学校上工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚创建了一个验证码,它可以在我自己的服务器上正常运行.在学校的服务器上,它不会生成图像.为什么会这样呢?代码的区别是一行.

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.

本来可以正常工作,但是我误删除了该目录,因此我不知道为什么突然间它会突然工作.

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.

更新:我 var_dumped()一切都已正确设置.学校服务器上的源代码:

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.

推荐答案

将此类问题直接发送给SO只是没有用的.
必须有成千上万的原因.而且,当然,在没有访问您的服务器和环境的情况下,没有人可以说,只需查看有效代码即可.

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);

,但是有时(例如在解析错误的情况下)这将无法工作.在这种情况下,您必须通过.htaccess设置这些参数,或者检查Web服务器的错误日志.

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.

此外,您还必须做点事情.
至少在脚本中添加一些文本输出,以确保其被执行.
使用var_dump()打印出变量,以确保您包含正确的值.添加一个故意的错误,以确保您可以看到它们(如果有).做点什么,不要坐在看代码!

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!

有关如何帮助自己的更多信息: http://www.ibm.com/developerworks/library/os-debug/

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

这篇关于为什么这可以在我的服务器上工作,而不在我的学校上工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆