Link to home
Start Free TrialLog in
Avatar of opticom
opticomFlag for Germany

asked on

PHP cannot connect to MySQL // Connecting to 3.22, 3.23 & 4.0 servers is not supported

Hi,

i've got some problems connecting our MySQL Server with PHP.
We are using PHP 5.3.20 ans MySQL 5.5.14

Everytime I try to connect to the mysql server I recieve the error message

"Connecting to 3.22, 3.23 & 4.0 servers is not supported"

As I said, we are running Version 5.5.14, so I can't unterstand whats the problem.

I already deleted and readded the Database and the Databaseuser.
If I switch back the PHP Version to 4.40 everything works fine.

Can somebody please help?
Avatar of Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

Can you post your PHP script that you use to connect
Please show us the complete error message, including the line numbers.  And show us the lines of PHP code.

And don't switch PHP back to Version 4.  PHP 5+ has been current for several years.
Avatar of opticom

ASKER

That's the only error message i get (with mysql_error)

That's the include code for all pages

<?php

$mysqlhost='xxx.xxx.xxx.xxx';
$mysqluser='frsdf.81';
$mysqlpwd='xxxxx'; 
$mysqldb='fwde';  

$connection = mysql_connect($mysqlhost, $mysqluser, $mysqlpwd) or die (mysql_error()); 

mysql_query("SET NAMES 'utf8'");
mysql_select_db($mysqldb, $connection) or die("Cannot connect database"); 

?>

Open in new window


In thats the way I open the database table in the index.php:

$sql_estz = "SELECT * FROM estz WHERE E_ID=$E_ID";
$estz_query = mysql_query($sql_estz) or die("Error );

Open in new window

It sounds like you have the MySQL driver leftover from PHP 4.4 because that's what causes that error message.  When you install PHP 5.xxx, it should COMPLETELY replace all of the code from PHP 4.4.  When I have upgraded PHP on my Windows machine, I rename the existing directory and put the new code in a different folder.  In addition,  you may have to go into your IIS setup and unclick 'Cache ISAPI applications' which is on the Home Directory tab under Configuration.  Then restart IIS at least once and maybe twice so it will read the new version of PHP.
ASKER CERTIFIED SOLUTION
Avatar of Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of opticom

ASKER

Hi,

I changed to MySQLi and everything works great.
No more errors...

Maybe later I'll have a look on PDO - sounds interesting - but at the moment MySQLi solves the problem for me...

Thank you
If MySQLi works for you then stick with it. PDO is just an alternative - not necessarily better or worse (although I do like named parameters available in PDO)