PHP - Monitoring-Script für Typo3 DB-Anbindung

Aus Laub-Home Wiki
<?php
        /*
         *      WUPCheck v1.0 / 2012-10-01
         *      Manuel Wendel
         */
        try {
                require_once dirname(__FILE__) . '/typo3conf/localconf.php';
                $l_DB = mysql_pconnect(
						$typo_db_host,
						$typo_db_username,
						$typo_db_password
					);
                if(!$l_DB) {
                        throw new Exception("wupcheck_status_failed: db connect error");
                } elseif(!mysql_select_db($typo_db, $l_DB)) {
                        throw new Exception("wupcheck_status_failed: db select error");
                }
                echo "wupcheck_status_ok";
        } catch(Exception $p_Exception) {
                echo $p_Exception->getMessage();
        }
?>