PHP数据库连接错误 [英] PHP database connection error

查看:85
本文介绍了PHP数据库连接错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我在php,mysql中有一个很烦人的错误.我已经正确配置了所有内容,并且phpinfo()正确列出了所有内容.我写了一个简单的PHP页面并进行检查,效果很好.

然后我要配置MySql.在php.ini上启用所有扩展,然后尝试查看以下页面.

Hi all,

I have a quite annoying error with php, mysql. I''ve configured all the stuff properly and phpinfo() list all the stuff properly. I wrote a simple PHP page and check, works fine.

Then I want to configure MySql. Enable all the extension on the php.ini and try to view the following page.

<?php
	$con = mysql_connect("localhost", "root", "sa");
	if (!$con) {
		die('Could not connect: ' . mysql_error());
	}
	else {
		echo 'Connected successfully';
	}
?> 



但这没有用.我检查了appache错误日志,并发现了以下内容.



But it didn''t work. I check the appache error log and found the following.

PHP Warning:  PHP Startup: Unable to load dynamic library 'C:\\php\\ext\\php_mysqli.dll' - The specified procedure could not be found.\r\n in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'C:\\php\\ext\\php_pdo_firebird.dll' - The specified module could not be found.\r\n in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'C:\\php\\ext\\php_pdo_mssql.dll' - The specified module could not be found.\r\n in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'C:\\php\\ext\\php_pdo_oci.dll' - The specified module could not be found.\r\n in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'C:\\php\\ext\\php_pdo_oci8.dll' - The specified module could not be found.\r\n in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'C:\\php\\ext\\php_pdo_pgsql.dll' - The specified module could not be found.\r\n in Unknown on line 0



所有扩展名也都在正确的路径中.不知何故,它不起作用.你们中有谁对此有解决方案...



All the extension are in correct path too. Somehow it didn''t work. Is anyone of you have a solution for this...

推荐答案

con = mysql_connect(" localhost" root"" ); 如果(!
con = mysql_connect("localhost", "root", "sa"); if (!


con){ die(' 无法连接:'.mysql_error()); } 其他 { echo ' 已成功连接'; } ?>
con) { die('Could not connect: ' . mysql_error()); } else { echo 'Connected successfully'; } ?>



但这没有用.我检查了appache错误日志,并发现了以下内容.



But it didn''t work. I check the appache error log and found the following.

PHP Warning:  PHP Startup: Unable to load dynamic library 'C:\\php\\ext\\php_mysqli.dll' - The specified procedure could not be found.\r\n in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'C:\\php\\ext\\php_pdo_firebird.dll' - The specified module could not be found.\r\n in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'C:\\php\\ext\\php_pdo_mssql.dll' - The specified module could not be found.\r\n in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'C:\\php\\ext\\php_pdo_oci.dll' - The specified module could not be found.\r\n in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'C:\\php\\ext\\php_pdo_oci8.dll' - The specified module could not be found.\r\n in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'C:\\php\\ext\\php_pdo_pgsql.dll' - The specified module could not be found.\r\n in Unknown on line 0



所有扩展名也都在正确的路径中.不知何故,它不起作用.你们中有谁对此有解决方案...



All the extension are in correct path too. Somehow it didn''t work. Is anyone of you have a solution for this...


这篇关于PHP数据库连接错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆