Home > php教程 > php手册 > body text

PHP5.3提示Fatal error: Undefined class constant MYSQL_ATTR_INIT_COMMAND

WBOY
Release: 2016-05-24 08:59:44
Original
1770 people have browsed it

下面来看看在使用php5.3时碰到的Fatal error: Undefined class constant MYSQL_ATTR_INIT_COMMAND错误解决办法。

今天帮朋友做了个简单的信息录入程序,本地调试一切OK,传到朋友的服务器后,死活不能用,一涉及数据库的读写就出现一个Fatal error.

Fatal error: Undefined class constant 'MYSQL_ATTR_INIT_COMMAND' 查来查去,原来是PHP5.3.0的BUG.

http://bugs.php.net/bug.php?id=47224

解决办法有两种,一是改代码

$pdb = new PDO("mysql:host=localhost;dbname=test", 'root');
$pdb->exec("SET NAMES utf8");
Copy after login

二就是升级你的PHP到更高的版本喽~~

所以,要从PHP5.2升级到PHP5.3的同学,要注意一下你的代码呀~~

文章网址:

随意转载^^但请附上教程地址。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template