testmysql.php errors (3x)?
Posted by: helices (---.hsd1.mn.comcast.net)
Date: July 04, 2015 09:12PM

I just installed latest wamperver

It appears to work; but, I get three (3) errors running: testmysql.php

[1] Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in E:\wamp\www\testmysql.php on line 2

[2] Warning: mysql_connect(): php_network_getaddresses: getaddrinfo failed: No such host is known. in E:\wamp\www\testmysql.php on line 2

[3] Warning: mysql_connect(): php_network_getaddresses: getaddrinfo failed: No such host is known. in E:\wamp\www\testmysql.php on line 2


What ought I do about these?

Please, advise. Thank you.

~ Mike

Options: ReplyQuote
Re: testmysql.php errors (3x)?
Posted by: Otomatic (Moderator)
Date: July 05, 2015 09:58AM

Hi,

testmysql.php should be:
<?php
/*    Using "mysqli" instead of "mysql" that is obsolete.
*     Utilisation de "mysqli" à la place de "mysql" qui est obsolète.
* Change the value of parameter 3 if you have set a password on the root userid
* Changer la valeur du 3e paramètre si vous avez mis un mot de passe à root
*/
$mysqli = new mysqli('127.0.0.1', 'root', '');

if ($mysqli->connect_error) {
    die('Connect Error (' . $mysqli->connect_errno . ') '
            . $mysqli->connect_error);
}
echo 'Connection OK';
$mysqli->close();
?>

> The mysql extension is deprecated and will be removed in...
See: [php.net]

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: testmysql.php errors (3x)?
Posted by: helices (---.hsd1.mn.comcast.net)
Date: July 05, 2015 05:58PM

Yes, of course, that works

Why does wampserver v2.5 us this 5 year old testmysql.php, since it is obsolete?

~ Mike

Options: ReplyQuote
Re: testmysql.php errors (3x)?
Posted by: Otomatic (Moderator)
Date: July 05, 2015 06:26PM

Hi,

> Why does wampserver v2.5 us this 5 year old testmysql.php, since it is obsolete?
I think this is a script which AlterWay did not think at the release of Wampserver 2.5 and which I have not thought at the beta test.
mysql extension is obsolete for PHP 5.5 and 5.6 but works. There is no mysql extension for PHP 7.0.0

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote


Sorry, only registered users may post in this forum.