Last active
January 9, 2017 18:41
-
-
Save benharold/f9f19b134c4f0b47c5548eeec0f74ab9 to your computer and use it in GitHub Desktop.
Ping script for PHP/MySQL application that uses dotenv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once(__DIR__ . '/vendor/autoload.php'); | |
$dotenv = new Dotenv\Dotenv(dirname(__FILE__)); | |
$dotenv->load(); | |
define('DB_NAME', getenv('DB_NAME')); | |
define('DB_USER', getenv('DB_USER')); | |
define('DB_PASS', getenv('DB_PASS')); | |
define('DB_HOST', getenv('DB_HOST')); | |
if ( ! mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME)) { | |
echo 'database error'; | |
} else { | |
echo 'pong'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment