php shell script

 

 

 


Maximum execution time

 

<?
set_time_limit(10);
while (true){
        //do this code;
        }
?>

Fatal error: Maximum execution time of 10 seconds exceeded in /root/test/test.php on line 6

 


check_db.php

 

Add MySQL User

CREATE USER 'chk_db_status'@'localhost' IDENTIFIED BY '***';
GRANT USAGE ON *.* TO 'chk_db_status'@'localhost';

check_db.php

<?php
        $server = "localhost";
        $user   = "chk_db_status";
        $pass   = "YOUR_PW";

        // Turn off all error reporting
        error_reporting(0);

        // Create connection
        $conn = @new mysqli($server, $user, $pass);

        // Check connection
        if ($conn->connect_error) {
                http_response_code(503);
                die("FAIL\n");
                //die("$conn->connect_error \n");
        }
        echo "OK";
?>

 


 

Creative Commons license icon Creative Commons license icon