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.

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.