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 MYSQL 多表拼接link
  • ¥15 关于某款2.13寸墨水屏的问题
  • ¥15 obsidian的中文层级自动编号
  • ¥15 同一个网口一个电脑连接有网,另一个电脑连接没网
  • ¥15 神经网络模型一直不能上GPU
  • ¥15 pyqt怎么把滑块和输入框相互绑定,求解决!
  • ¥20 wpf datagrid单元闪烁效果失灵
  • ¥15 券商软件上市公司信息获取问题
  • ¥100 ensp启动设备蓝屏,代码clock_watchdog_timeout
  • ¥15 Android studio AVD启动不了