简体   繁体   English

mysql_connect不能代替本地服务器在远程服务器上工作

[英]mysql_connect can not work in remote server in stead of local server

I got such warning : 我得到了这样的警告:

Warning: mysql_connect(): Headers and client library minor version mismatch. Headers:50537 Library:50617

when try to upload my code to my remote server, and my remote server currently using php 5.5 , It's because the mysql extension has been already deprecated so that i have to change the extension to mysqli? 当尝试将我的代码上传到远程服务器以及当前使用php 5.5的远程服务器时,这是因为mysql扩展名已被弃用,因此我必须将扩展名更改为mysqli吗? but in my local server, i tested in php 5.5 too and it works as normal 但是在我的本地服务器上,我也在php 5.5中进行了测试,它可以正常工作

what would be the issue here? 这里的问题是什么?

If you are running ubuntu/debian. 如果您正在运行ubuntu / debian。

     apt-cache search php5-mysqlnd

Find one that fits: 找到一个合适的:

     apt-get install php5-mysqlnd

I think your issue is this : 我认为您的问题是这样的

After having MySQL 5.6.17 published, some users complained about a warning thrown by their PHP applications : 在发布MySQL 5.6.17之后,一些用户抱怨他们的PHP应用程序引发了警告:

PHP Warning: mysql_connect(): Headers and client library minor version mismatch. PHP警告:mysql_connect():标头和客户端库次要版本不匹配。 Headers:50535 Library:50617 标头:50535图书馆:50617

In fact, this could happen with any application linked to libmysqlclient18 in a certain version (php5-mysql from Dotdeb is linked to the 5.5.35 version from the stock Debian distribution) when connecting to a MySQL server in another version (5.6.17 in our case). 实际上,当连接到另一个版本(5.6.17中的版本)的MySQL服务器时,在某个版本中链接到libmysqlclient18的任何应用程序都可能发生这种情况(Dotdeb的php5-mysql从Debian发行版链接到5.5.35版本)。我们的情况)。 The warning is thrown by libmysqlclient18 itself. 该警告由libmysqlclient18本身引发。 And this is just a warning, there is no reason why any bad behavior would happen in that case. 这只是一个警告,在这种情况下没有任何不良行为发生的理由。

Of course, I could build php5-mysql against the latest libmysqlclient18 (5.6.17), but it would lead to very bad issues, such as duplicate symbols or segfaults when PHP is loaded with other MySQL-linked modules from the stock Debian distribution (those are linked to libmysqlclient18 5.5.35). 当然,我可以针对最新的libmysqlclient18(5.6.17)构建php5-mysql,但这会导致非常严重的问题,例如,当从库存的Debian发行版中向PHP加载其他与MySQL链接的模块时,符号就会重复或出现段错误(这些链接到libmysqlclient18 5.5.35)。 For example : mod_php5 + Apache + mod_auth_mysql would crash. 例如:mod_php5 + Apache + mod_auth_mysql将崩溃。

If this this warning really annoys you, feel free to install php5-mysqlnd instead of php5-mysql : 如果此警告确实使您感到困扰,请随时安装php5-mysqlnd而不是php5-mysql:

 it's a drop-in replacement it's not linked against any libmysqlclient library it won't throw any irrelevant warning about version mismatch it has a lot of benefits. See http://www.php.net/mysqlnd for more info 

I hope this helps. 我希望这有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 mysql_connect在远程主机连接上返回“无法通过套接字连接到本地MySQL服务器”? - mysql_connect returning “Can't connect to local MySQL server through socket” on remote host connection? mysql_connect从本地计算机连接到远程服务器 - mysql_connect to Remote Server from local machine 警告:mysql_connect():无法连接到本地 MySQL 服务器 - Warning: mysql_connect(): Can't connect to local MySQL server 警告:mysql_connect():无法通过套接字“ /tmp/mysql.sock”连接到本地MySQL服务器(2) - Warning: mysql_connect(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) 远程php mysql_connect到在家设置的SQL Server - remote php mysql_connect to SQL server set up at home 在mysql_connect上使用端口转发和php到远程服务器上 - Using port forwarding and php with mysql_connect onto a remote server mysql_connect在通过VPN的服务器中不起作用 - mysql_connect not working in a server over a VPN mysql_connect()没有到达正确的服务器 - mysql_connect() is not getting to the correct server 无法将本地WordPress连接到远程MySQL服务器 - Can't connect local WordPress to a remote MySQL server 为什么我会得到mysql_connect():与MySQL服务器的连接断开,该如何解决? - Why am I getting mysql_connect(): Lost connection to MySQL server and how can I fix it?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM