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.

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

报告相同问题?

悬赏问题

  • ¥15 一道python难题2
  • ¥15 一道python难题
  • ¥15 用matlab 设计一个不动点迭代法求解非线性方程组的代码
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 oracle集群安装出bug
  • ¥15 关于#python#的问题:自动化测试
  • ¥20 问题请教!vue项目关于Nginx配置nonce安全策略的问题
  • ¥15 教务系统账号被盗号如何追溯设备