dongxie45083 2016-05-23 09:53
浏览 34

Code Igniter中的运行状况检查页面:在任何PHP错误上返回非200状态代码

I'm trying to implement a simple health check page (to use with ELB). It connects to the database, loads a model, and returns a 200 status code if everything is OK, and a non 200 status code if something goes wrong.

The problem that I am having is that Code Igniter seems to return a 200 status code when non fatal PHP errors are encountered. Can I modify that behaviour (if possible only for a specific controller)?

To be clear, currently I get a 200 status code even when there's an error:

A PHP Error was encountered Severity: Warning Message: mysqli::real_connect(): (HY000/1045): Access denied for user 'X'@'Y' (using password: YES) Filename: mysqli/mysqli_driver.php Line Number: 202

I want to return a non 200 in this case (bc that's what makes sense for a health check page).

Any ideas?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 关于#hadoop#的问题
    • ¥15 (标签-Python|关键词-socket)
    • ¥15 keil里为什么main.c定义的函数在it.c调用不了
    • ¥50 切换TabTip键盘的输入法
    • ¥15 可否在不同线程中调用封装数据库操作的类
    • ¥15 微带串馈天线阵列每个阵元宽度计算
    • ¥15 keil的map文件中Image component sizes各项意思
    • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
    • ¥15 划分vlan后,链路不通了?
    • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据