I am on a hosted server. I use mysql commands to access the database. However, when I try to use mysqli commands, which are suppose to be more secure, I get the following response: The server requested authentication method unknown to the client. I went to a different host and now I get: Fatal error: Call to undefined function: mysqli_connect(). What am I doing wrong?
Asked
Active
Viewed 187 times
0
-
First, you should create a php test file (test.php) containing ``. Open this page in your browser and make sure you have the mysql/mysqli extension loaded in your php. The mysqli_connect function requires, on ubuntu for example, the php5-mysql package to be installed, according the [documentation](http://php.net/manual/en/mysqli.installation.php). – Manu Eidenberger Dec 29 '15 at 15:09
-
I did as you said, and mysqli seems to be running. However, every time I try to use it I still get the following error: The server requested authentication method unknown to the client. Mysql works perfectly, but mysqli has this authentication error. – Robert Lattery Dec 29 '15 at 23:38
-
maybe this link will help you : 1. [DBA Stackexchange](http://dba.stackexchange.com/questions/34024/server-requested-authentication-method-unknown-to-the-client-mysql-old-password) 2. [MySQL Remote Connection](http://stackoverflow.com/questions/14612551/mysql-remote-connection-fails-with-unknown-authentication-method) – Konsultan IT Bandung Dec 29 '15 at 23:39
2 Answers
0
You should upgrade your PHP it's enabled by default in the last versions.
If you cannot do this then you need to go into the php.ini
file and uncomment that extension.

meda
- 45,103
- 14
- 92
- 122
-
Again, this is on a hosted server. This is not my personal server, so I cannot adjust the php.ini file. – Robert Lattery Dec 29 '15 at 23:29
-
-
The php version on the shared server is PHP 5.5.22. There is no option to upgrade any further. I have no access to the php.ini file. The same error keeps popping up. – Robert Lattery Dec 29 '15 at 23:53
-
I suggest you get in contact with your hosting service or you can try PDO, its better anyway – meda Dec 30 '15 at 00:54
0
make sure you have the mysql/mysqli extension loaded in your php
php -m | grep -i mysql
You will get result :
[root@yourserver ~]# php -m | grep -i mysql
mysql
mysqli
pdo_mysql

Konsultan IT Bandung
- 141
- 1
- 2
- 17
-
This is not my server. This is on a hosted server, so I have no access to adjust the php files. – Robert Lattery Dec 29 '15 at 23:30