doushenjia8514 2014-03-22 12:06
浏览 97
已采纳

遇到数据库错误时,Codeigniter返回500内部服务器错误而不是错误消息

Just started working with CodeIgniter this week and am encountering a weird issue that has me stumped. Whenever there are any database related errors encountered in my application I just get a 500 internal server error page. I get PHP errors for everything else, the only errors I have noticed that I get this behavior on are database related.

Two examples of this behavior:

  1. I noticed this first when tried to query a database using a string for criteria to evaluate an integer field
  2. Noticed this when I tried to create a database object using a reference to a database that hadn't been defined yet in database.php.

I have CodeIgniter running an IIS server and I am using a SQL Server for the database. I can get the application to access the database, it's just when there are errors I can't get an error message, just a 500 page.

Here are the things I've verified so far:

  1. db_debug is set to TRUE in database.php.
  2. In index.php the environment is set to development.
  3. In php.ini display_errors is set to On.

Any help would be greatly appreciated, not sure what else to check.

  • 写回答

1条回答 默认 最新

  • dongyimeng3764 2014-05-01 19:30
    关注

    Ended up finding out that the problem was that I didn't have the appropriate user permissions assigned to the directory that Code Igniter was trying to write log files to. After fixing this, I do not seem to be having the same issue. I now just get an error message with information on the database error instead.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥30 python代码,帮调试,帮帮忙吧
  • ¥15 #MATLAB仿真#车辆换道路径规划