来自Php脚本的Mysql / Apache连接错误

时间:2010-01-31 14:37:04

标签: php mysql apache

我正在尝试使用php。我按照教程中的说明编写了一个小脚本。我正在使用Wampserver 2.0。连接很好。但每当我尝试执行脚本时,我得到“Apache HTTP服务器遇到问题并需要关闭”错误消息。我的localhost工作正常。没有mysql语句的普通php脚本工作正常。我的数据库连接正常。那有什么问题?

版本:

Php: 5.3.0
Apache: 2.2.11
MySql: 5.1.36

剧本:

<?php

mysql_connect ('localhost', 'root', '') ;
mysql_select_db ('blog');

/* 
 * Setup a db table named blog which is gonna contain blog posts
 * max number of entries: 2,359,296. Because we declared id to be an int of 20.
 * primary key: id
 * id - auto increment so that next entry will get the next primary number available 
 */
$sql = "CREATE TABLE blog (
  id int(20) NOT NULL auto_increment,
  timestamp int(20) NOT NULL,
  title varchar(255) NOT NULL,
  entry longtext NOT NULL,
  PRIMARY KEY  (id)
)";

// Create the blog table
$result = mysql_query($sql) or
print ("Can't create the table 'blog' in the database!<br />".$sql."<br />". mysql_error()); 

if ($result != false) {
    echo "Table 'blog' was successfully created.";
}

mysql_close();

?>

Apache错误日志(看不到任何关键):

[Sun Jan 31 09:49:29 2010] [notice] Parent: child process exited with status 3221225477 -- Restarting.
[Sun Jan 31 09:49:29 2010] [notice] Apache/2.2.11 (Win32) PHP/5.3.0 configured -- resuming normal operations
[Sun Jan 31 09:49:29 2010] [notice] Server built: Dec 10 2008 00:10:06
[Sun Jan 31 09:49:29 2010] [notice] Parent: Created child process 11172
[Sun Jan 31 09:49:29 2010] [notice] Child 11172: Child process is running
[Sun Jan 31 09:49:29 2010] [notice] Child 11172: Acquired the start mutex.
[Sun Jan 31 09:49:29 2010] [notice] Child 11172: Starting 64 worker threads.
[Sun Jan 31 09:49:29 2010] [notice] Child 11172: Starting thread to listen on port 80.
[Sun Jan 31 09:49:32 2010] [notice] Parent: child process exited with status 3221225477 -- Restarting.
[Sun Jan 31 09:49:33 2010] [notice] Apache/2.2.11 (Win32) PHP/5.3.0 configured -- resuming normal operations
[Sun Jan 31 09:49:33 2010] [notice] Server built: Dec 10 2008 00:10:06
[Sun Jan 31 09:49:33 2010] [notice] Parent: Created child process 10244
[Sun Jan 31 09:49:33 2010] [notice] Child 10244: Child process is running
[Sun Jan 31 09:49:33 2010] [notice] Child 10244: Acquired the start mutex.
[Sun Jan 31 09:49:33 2010] [notice] Child 10244: Starting 64 worker threads.
[Sun Jan 31 09:49:33 2010] [notice] Child 10244: Starting thread to listen on port 80.

修改

固定。刚刚将Php版本降级为5.2.8。

1 个答案:

答案 0 :(得分:1)

听起来像是不兼容的mysql模块(不是针对你正在使用的php版本构建的),apache errorlog应该包含有关错误的更多信息。

如果你不能/不想修复它,你可以尝试使用另一个wamp / xamp发行版。