dongyan5706 2010-01-31 14:37
浏览 143
已采纳

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

I am trying to use php. I wrote a small script as instructed in the tutorial. I am using Wampserver 2.0. Connection is fine. But whenever I try to execute the script, I get "Apache HTTP server encountered a problem and needs to close" error message. My localhost is working fine. Normal php scripts without mysql statements in it is working fine. My db connection is ok. So what's the problem?

Versions:

Php: 5.3.0
Apache: 2.2.11
MySql: 5.1.36

The script:

<?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 error log (Don't see anything critical):

[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.

EDIT:

Fixed. Just downgraded the Php version to 5.2.8.

  • 写回答

1条回答 默认 最新

  • ds11111111111111111 2010-01-31 14:41
    关注

    Sounds like incompatible mysql module (not built against the php version you are using), the apache errorlog should containt more information about the error.

    If you can't/don't want to fix it you could try to use another wamp/xamp distribution.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料