2010-11-23 52 views
0

MySQL拒絕使用Apache 2.2和PHP 5.2。MySQL拒絕在Windows 7或Win2k3上使用Apache 2.2和PHP 5.2

我一直與一個朋友,誰是試圖讓這個在Windows 7 64位工作,我一直在嘗試Windows 2003 Server上,我們都有同樣的問題 - MySQL將不被認可。從命令行MySQL工作正常,但PHP和/或Apache不會加載MySQL模塊。

phpinfo()不顯示它已安裝。 Apache和PHP工作正常。

任何人有任何想法?請注意,我已經在至少100個網站上閱讀過100篇關於如何解決此問題的文章。所以我正在尋找具體的信息,而不是猜測。

沒有侮辱任何人意,但畢竟距離安大略3天,長途電話到加州,我需要的結果我去破了,發瘋了。

+0

我種需要的不僅僅是更多的細節「它不工作'。你的php.ini配置是什麼樣的?你有沒有extension = php_mysql.dll extension = php_mysqli.dll uncommented? – Paul 2010-11-23 02:02:08

+0

WAMP是無憂無慮的 - 有一個插件,允許您在MySQL版本之間切換。我也推薦toad for mysql :) – 2010-11-23 02:42:23

回答

1

在文件系統上查找php\ext\php_mysqli.dll(這是安裝xampp的路徑)。只有PHP需要這個模塊,Apache只需要執行PHP。所以檢查你有沒有

extension=php_mysql_libmysql.dll 

php\php.ini。隨着MySQL的

[MySQLi] 
mysqli.allow_local_infile = On 
mysqli.allow_persistent = Off 
mysqli.cache_size = 2000 
mysqli.max_persistent = -1 
mysqli.max_links = -1 
mysqli.default_port = 3306 
... 

一個配置部分,你在嘗試使用mysqli_query()等功能有哪些誤區?

如果你真的無法正常工作,excellend和xampp會在你選擇的操作系統上安裝完整的* AMP堆棧,而且很少麻煩。

編輯: @Beauford如果函數未定義,那麼庫不加載。遵循以上的MySQLi說明,如果這仍然不起作用與一個或許有關Win7的troubleshooting guide in the comments沿here(原始拷貝)包安裝步驟:

to enable the mysql_... and mysqli_... functionality, i opened the php.ini file to uncomment the following lines:

;extension=php_mysql.dll 
;extension=php_mysqli.dll 
;extension=php_pdo_mysql.dll 

but phpinfo() still stated that no mysql extensions were loaded. i tried the fixes and suggestions above with no success. so i invoked the windows shell and typed ("Path" environment variable set to the PHP & MySQL directories): php.exe -m

this returned the following error: PHP Startup: Unable to load dynamic library 'C:\php5\php_mysql.dll' - Module not found.

this told me that PHP didn't recognize what i thought was the extensions directory. it searched all other places first (sys-dir, workin'-dir, the MySQL "bin" dir because of the "Path" variable set, and even a curious directory "C:\php5" that doesn't even exist on my mashine) but not the expected "ext" directory.

so the fix was to go to "php.ini" again and uncomment the following line:

;extension_dir="ext"

相關問題