Created
October 24, 2014 14:31
-
-
Save kolyadin/3ec2ec43d4227072c0c2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
# Это скрипт для проверки работоспособности базы данных MySQL. | |
# Версия: 1. | |
# Далее идут настройки, которые вам необходимо указать. | |
######################################################################### | |
# Сервер. В большинстве случаев сервер именно localhost, если ваш хостинг-провайдер не указывает другое. | |
$host='localhost'; | |
# Порт сервера. В большинстве случаев порт 3306, если ваш хостинг-провайдер не указывает другое. | |
$port='3306'; | |
# Имя пользователя для подключения к MySQL | |
$user=''; | |
# Пароль для подключения к MySQL | |
$password=''; | |
# Имя базы данных | |
$db_name=''; | |
############# Конец настроек. Далее изменения не требуются. ############# | |
######################################################################### | |
$link = @mysql_connect($host.($port!='' ? ':'.$port : ''), $user, $password); | |
if (!$link) die(mysql_error()); | |
if ($db_name!='') { | |
$db_selected = @mysql_select_db($db_name, $link); | |
if (!$db_selected) die(mysql_error()); | |
} | |
echo 'OK'; | |
mysql_close($link); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment