簡體   English   中英

PHP腳本的MySQL / Apache連接錯誤

[英]Mysql/Apache connection error from Php script

我正在嘗試使用php。 我按照教程中的指示編寫了一個小腳本。 我正在使用Wampserver 2.0。 連接很好。 但是,每當我嘗試執行腳本時,都會收到“ Apache HTTP服務器遇到問題,需要關閉”錯誤消息。 我的本地主機工作正常。 沒有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。

聽起來像不兼容的mysql模塊(不是針對您使用的php版本構建的),apache錯誤日志應包含有關該錯誤的更多信息。

如果您不能/不想修復它,可以嘗試使用其他wamp / xamp發行版。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM