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.

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

报告相同问题?

悬赏问题

  • ¥120 目前wxid加好友的渠道都被和谐了吗
  • ¥15 关于#网络#的问题:网络是从楼上引一根网线下来,接了2台傻瓜交换机,也更换了ip还是不行
  • ¥15 资源泄露软件闪退怎么解决?
  • ¥15 各位佬,下面的问题怎么用python实现?
  • ¥15 CCF-CSP 2023 第三题 解压缩(50%)
  • ¥30 comfyui openpose报错
  • ¥20 Wpf Datarid单元格闪烁效果的实现
  • ¥15 图像分割、图像边缘提取
  • ¥15 sqlserver执行存储过程报错
  • ¥100 nuxt、uniapp、ruoyi-vue 相关发布问题