dongna1593 2015-10-26 15:17
浏览 117
已采纳

AWS ELB - 应用程序运行状况检查 - 示例PHP页面

I am trying to understand what would be the best to have in a PHP page in order to check the health of the application.

This is one of the configuration while setting up Elastic Bean Stalk - Application health check URL

Is there any sample page out there that I can use.

  • 写回答

1条回答

  • dougaoshang0237 2015-10-26 17:53
    关注

    You need to figure out what your application needs to be considered healthy.

    do you use a database? Can you connect to it? Can you run a simple query with known results?

    For a simple PHP+Mysql app that might be enough.

    <?PHP
    if(connect to MySQL){
        if(connection is good){
           run a query
           if(result of query is good){
               echo 'healthy';
               exit();
           }
        }
    }
    //all other scenarios are bad
    echo 'failure';
    exit();
    ?>
    

    If your app requires other things like a Redis cache or some other dependency then you should verify that is working too. This is a super simple example but remember this is going to be called pretty frequently so you want it to be fast.

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

报告相同问题?

悬赏问题

  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 spring后端vue前端
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题