hello dear experts here at Daniweb,
first of all i am pretty new to this site - to daniweb. I am new to this site. My interests are Programming in PHP, Python and running websites - with WordPress.
Well - i am running webadmin - a Apache and MySQL-Server-frontend- for years now. now i run into troubles when establishing a db connection.
i thought that during the installation process the file wp-config-sample.php gets to wp-config.php - but this is not happening.- i have gathered some more infos and inights due to some tests. see the following data: - the outcome of a testscript:
Warning: mysqli_connect(): (HY000/2002): No such file or directory in /sites/www.mysite.de/tests.php on line
Warning: mysqli_error() expects parameter 1 to be mysqli, boolean given in /sites/www.mysite.de/tests.php on line could not connect
see the script;
<?php
if(function_exists('mysqli_connect')){
if(!($link = mysqli_connect('localhost','user','passwd','my_db'))){
die('could not connect: ' . mysqli_error($link));
}
} else {
die("don't have mysqli");
}
echo 'connect successfully';
mysqli_close($link);
on the webmin-frontend (that is the area i have to controll and configure all the stuff on the server')
1 USE yourdatabase;
2 SHOW GLOBAL VARIABLES LIKE 'PORT';
3 SHOW GRANTS FOR CURRENT_USER;
i get back the following results:
check the manual that corresponds to your MySQL server version for the right syntax to use near ''name of my db';
SHOW GLOBAL VARIABLES LIKE 'PORT'; SHOW GRANTS FOR CURRENT_USER' at line 1
and the following
Failed to execute SQL : SQL USE 'name of my db'; SHOW GLOBAL VARIABLES LIKE 'PORT';
SHOW GRANTS FOR CURRENT_USER; failed : You have an error in your SQL syntax;
i am a bit unsure what i can do now.
well - since there is no connection_error property in mysqli. i think that i have to check connection error using
if ($conn->connect_error) {
die('Connect Error: ' . $conn->connect_error);
}
i have to read the manpages here http://php.net/manual/en/mysqli.connect-error.php in order to learn what i need to get more insights.,
btw: I have Linux Server. Apache 2.4.10, PHP Version 5.6.39 and mysqlnd 5.0.11-dev - 20120503 - installed. There are several wordpress website running on server.
do i have MySQL or MySQLi - i am not sure.
how to get more insights ... ?
what would you do now!?
generally spoken:
- The now extinct mysql library and the mysqli library are two completely different animals.
- that s3aid - we surely can forget about mysqli and use PDO.
- i have to ponder on all the options and possibilities.
- Afterward i need to do more chekcs
see here a quick and dirty comparison of the different systems ...
+---------+-------------+
| mysql | dodo ;) |
| mysqli | donkey ;) |
| PDO | racehorse ;) |
what can i do else.
i am willing to learn. And yes: i need to learn all bout the 1. The now extinct mysql library and the mysqli library are two completely different animals.