环境如题
http://topic.csdn.net/u/20111010/14/1e62cba9-05a3-4c66-bf73-541040deb284.html这个是我没有使用mysql时的配置使用php连接mysql的配置后,曾经也出过错,上网查了,然后把php5目录下的php5apache2_2.dll放到了win32目录下,然后使用mysql里的libmysql.dll把php5目录下的替换掉,同样copy一份放在了win32目录下。我连接数据库的例子代码如下:hello.php<html>
<head>
<title>connect myslq test</title>
</head>
<body>
<?php
/*连接mysql数据库*/
$link = mysql_connect("localhost","mysql","pwd") or die("Could not connect");
print("connect successfully");
mysql_select_db("finance") or die("Could not select database");
/*执行SQL查询*/
$query = "select * from web_user_login";
$result = mysql_query($query) or die("Query failed");
/*在 HTML 中打印结果*/
?>
<table>
<?php
while($line = mysql_fetch_array($result,MYSQL_ASSOC)){
?>
<tr>
<?php
foreach($line as $col_value);
?>
</tr>
<?php
}
/*释放资源*/
mysql_free_result($result);
/*断开连接*/
mysql_close($link);
?>
</table>
</body>
</html>
当我访问hello.php的时候,IE弹出崩溃窗口,无法显示该网页error.log日志如下:[Wed Oct 12 10:49:22 2011] [notice] Parent: child process exited with status 3221225477 -- Restarting.
[Wed Oct 12 10:49:24 2011] [notice] Apache/2.2.6 (Win32) PHP/5.2.17 configured -- resuming normal operations
[Wed Oct 12 10:49:24 2011] [notice] Server built: Sep 5 2007 08:58:56
[Wed Oct 12 10:49:25 2011] [notice] Parent: Created child process 4252
[Wed Oct 12 10:49:25 2011] [notice] Child 4252: Child process is running
[Wed Oct 12 10:49:25 2011] [notice] Child 4252: Acquired the start mutex.
[Wed Oct 12 10:49:25 2011] [notice] Child 4252: Starting 250 worker threads.
[Wed Oct 12 10:49:25 2011] [notice] Child 4252: Starting thread to listen on port 80.在网上搜索的答案,基本都是写把php5目录下的那两个dll文件放到win32目录下就解决了,为什么我的不可以呢?
大家看一下,是我环境配置的不对,还是我的php代码有问题啊,代码是在网上找的一个例子写的
http://topic.csdn.net/u/20111010/14/1e62cba9-05a3-4c66-bf73-541040deb284.html这个是我没有使用mysql时的配置使用php连接mysql的配置后,曾经也出过错,上网查了,然后把php5目录下的php5apache2_2.dll放到了win32目录下,然后使用mysql里的libmysql.dll把php5目录下的替换掉,同样copy一份放在了win32目录下。我连接数据库的例子代码如下:hello.php<html>
<head>
<title>connect myslq test</title>
</head>
<body>
<?php
/*连接mysql数据库*/
$link = mysql_connect("localhost","mysql","pwd") or die("Could not connect");
print("connect successfully");
mysql_select_db("finance") or die("Could not select database");
/*执行SQL查询*/
$query = "select * from web_user_login";
$result = mysql_query($query) or die("Query failed");
/*在 HTML 中打印结果*/
?>
<table>
<?php
while($line = mysql_fetch_array($result,MYSQL_ASSOC)){
?>
<tr>
<?php
foreach($line as $col_value);
?>
</tr>
<?php
}
/*释放资源*/
mysql_free_result($result);
/*断开连接*/
mysql_close($link);
?>
</table>
</body>
</html>
当我访问hello.php的时候,IE弹出崩溃窗口,无法显示该网页error.log日志如下:[Wed Oct 12 10:49:22 2011] [notice] Parent: child process exited with status 3221225477 -- Restarting.
[Wed Oct 12 10:49:24 2011] [notice] Apache/2.2.6 (Win32) PHP/5.2.17 configured -- resuming normal operations
[Wed Oct 12 10:49:24 2011] [notice] Server built: Sep 5 2007 08:58:56
[Wed Oct 12 10:49:25 2011] [notice] Parent: Created child process 4252
[Wed Oct 12 10:49:25 2011] [notice] Child 4252: Child process is running
[Wed Oct 12 10:49:25 2011] [notice] Child 4252: Acquired the start mutex.
[Wed Oct 12 10:49:25 2011] [notice] Child 4252: Starting 250 worker threads.
[Wed Oct 12 10:49:25 2011] [notice] Child 4252: Starting thread to listen on port 80.在网上搜索的答案,基本都是写把php5目录下的那两个dll文件放到win32目录下就解决了,为什么我的不可以呢?
大家看一下,是我环境配置的不对,还是我的php代码有问题啊,代码是在网上找的一个例子写的
ini_set("display_errors", "On");
error_reporting(E_ALL | E_STRICT);
当然,如果能够修改php.ini的话,如下即可:
display_errors = On
error_reporting = E_ALL
php.ini已经修改了,还是老样子(网页无法显示),需要重启机器吗? 如果有错误信息的话,是在页面上看吗?
不依靠mysql的代码是可以的,能够在页面正常显示
而未设置extension_dir,extension_dir默认为'./'此处需要修改成:extension_dir = 'c:\php5\extension'(即php5的扩展目录)这样就可以正常的获取到数据库的连接了
========================================================
再次感谢楼上各位的热心回答~