I have a simple HTML form that that tries to connect to a database hosted on a remote server. The form tries to connect to the database with the following script: (EDITED following davejal suggestions)
<?php
ini_set('display_errors', 1);
ini_set('log_errors', 1);
ini_set('error_log', dirname(__FILE__) . '/error_log.txt');
error_reporting(E_ALL);
$error='';
echo "<p>Test</p>" ;
define('DB_HOST', 'mysql.utk.edu:3306');
define('DB_NAME', 'emoschan_test');
define('DB_USER','emoschan');
define('DB_PASSWORD','NewPass');
echo " Does mysql exist?". var_dump(function_exists('mysql_connect'));
echo " Does mysqli exist?". var_dump(function_exists('mysqli_connect'));
$con=mysql_connect(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME) or die("Failed to connect to MySQL: " . mysql_error());
if (mysql_connect_error($con)) { echo "Third Failed to connect to MySQL:" . mysql_connect_error(); }
else { echo "<p>Successfully connected to your database</p>"; }
?>
The connection fails and I receive the followin error ( I include a screenshot of the error):
Failed to connect to MySQL: Client does not support authentication protocol requested by server; consider upgrading MySQL client
output when I click "submit" the form
As you see the mysqli doesn't exist.
I have tried to change the password to the old encryption, still get the error (phpmyadmin screenshot): change to OLD password
2nd EDIT. phpinfo() shows PHP version 5.3.0 and "Client API version : 4.0.31"
phpInfo();then you will see a lot of information about PHP, version etc. and what drivers are loaded etc. - Ryan Vincent