配置最新的PHP加MYSQL伺服器

來源:互聯網
上載者:User
mysql|伺服器 通過一個小時的研究和設定.實現了最新的 PHP 5.0 + MYSQL 5.0 + WIN2003.
個人認為還是有必要寫個教程出來.因為很多方面和老版本的不盡相同.
說實話自己也是查閱了很多官方文檔才解決了很多怪異問題.

=========================

相關軟體均可以在 WWW.SKYCN.NET 下載.

MYSQL 5.0 FOR WINDOWS
PHP 5.0 FOR WINDOWS
PHPMYADMIN
WINDOWS SERVER 2003

=========================

首先安裝 MYSQL .本來以為新版本的安裝介面應該會花哨點.
但是仍然只看到老土的海豚.除了安裝時間比 4.0 長.當然咯.因為 5.0 比 4.0 體積大很多.

推薦安裝在獨立的 NTFS 分區上.比如我伺服器的 F盤.只放伺服器軟體.
路徑為: F:MYSQL

然後進入 F:MYSQLBIN 滑鼠雙點 winmysqladmin.exe
首次運行會提示輸入超級使用者和密碼.就輸入 root 密碼 root
注意啊.如果是對外伺服器請設定超級複雜.比如 Wjwsfjn29szjwh~mysql
翻譯過來就是: 我叫魏舒芬.今年29歲至今未婚.

到這裡.MYSQL就安裝完畢了.如果不明白請參看深空同學的相關文章.

=========================

下面安裝 PHP 5.0 其實沒什麼安裝不安裝的.解壓縮檔案.推薦放到
路徑為: F:PHP

到這裡就應該進入關鍵步驟了.
首先複製 PHP 目錄下的 Php.ini-dist 到 C:Windows 並將檔案名稱修改成為 Php.ini

COPY F:PHPPhp.ini-dist C:Windows
Ren Php.ini-dist Php.ini

如果是 WINDOWS 2000 就是: C:WINNT
如果是 WIN9X / 2003 就是: C:Windows

然後複製 PHP 目錄下 DLLS 目錄裡的所有檔案到 SYSTEM32 目錄.

COPY F:PHPdlls*.* C:WindowsSystem32

如果是 WINDOWS 2000 就是: C:WINNTSystem32
如果是 WIN9X / 2003 就是: C:WindowsSystem32

繼續.複製PHP目錄下 php4ts.DLL 檔案到 System32 目錄裡.

COPY F:PHPphp4ts.dll C:WindowsSystem32

=========================

到這裡複製工作全部完成.下面修改 C:WindowsPhp.ini 檔案.

請注意.5.0的版本修改與4.0並不完全相同.需要注意的如下.

尋找 extension_dir 字串.修改為你 PHP 目錄裡 extensions 的路徑.

; Directory in which the loadable extensions (modules) reside.
extension_dir = F:PHPextensions

相關官方技術資料:

Edit your php.ini file:

You will need to change the 'extension_dir' setting to
point to your php-install-dir, or where you have placed
your 'php_*.dll' files. ex: c:php

If you are using OmniHTTPd, do not follow the next step.
Set the 'doc_root' to point to your webservers
document_root. ex: c:apachehtdocs or c:webroot

Choose which extensions you would like to load when PHP
starts, noting that several extensions are already built
into the Windows release, see the section about
Windows extensions for details of the built-in extensions.
You can uncomment the: 'extension=php_*.dll' lines
in php.ini to load these extensions.

Note that on a new installation it is advisable to first get
PHP working and tested without any extensions before enabling
them in php.ini.

On PWS and IIS, you can set the browscap.ini
to point to: 'c:windowssysteminetsrvrowscap.ini' on
Windows 9x/Me and 'c:winntsystem32inetsrvrowscap.ini'
on NT/2000/XP Server.

More information on the capabilities of browscap can be found here:

www.php.net/manual/en/function.get-browser.php

Note that the mibs directory supplied with the Windows distribution
contains support files for SNMP. This directory should be moved to
DRIVE:usrmibs (DRIVE being the drive where PHP is installed.)

然後與 PHP 4.0 不同的是.需要修改 Php.ini 檔案裡的如下內容:
尋找 cgi.force_redirect 字串.預設值為1.將其修改為0.並取消前面的;號.

即:

; cgi.force_redirect is necessary to provide security running PHP as a CGI under
; most web servers. Left undefined, PHP turns this on by default. You can
; turn it off here AT YOUR OWN RISK
; **You CAN safely turn this off for IIS, in fact, you MUST.**
cgi.force_redirect = 0

切記如上修改的地方.否則PHP 5.0是無法啟動並執行.會有如下提示.

Security Alert! The PHP CGI cannot be accessed directly.

相關官方技術資料:

!NOTE!: Since 4.1.2, the php.ini setting cgi.force_redirect defaults to '1'
which effectively prevents the cgi from working within IIS. You need to set
up at least a minimal php.ini file with the following directive:

cgi.force_redirect = 0

If it doesn't work immidiately, make sure you have the php.ini file in the
right place (%SYSTEMROOT%php.ini).

接下來修改 Php.ini 檔案關於 MYSQL 5.0 的設定.

尋找 [MySQL] 欄位內的內容.修改如下.

mysql.default_port = 3306
// 這裡是MYSQL的連接埠.

mysql.default_host = localhost
// 這裡是本地主機.

mysql.default_user = root
// 這裡是使用者

mysql.default_password = Wjwsfjn29szjwh~mysql
// 這裡是密碼

修改到這裡就可以讓 Php 與 MYSQL 關聯了.
最後啟動 PHP 對 MYSQL 模組支援.

尋找 extension=php_mysql.dll 字串.刪除掉前面的 ; 號

extension=php_mysql.dll

請注意.如果不啟動 PHP 對 MYSQL 模組支援.將無法使 PHPMYADMIN 正常工作.將提示:

cannot load MySQL extension, please check PHP Configuration
無法裝入 MySQL 擴充,請檢查 PHP 的配置。

相關官方技術資料:

To connect to a MySQL server, PHP needs a set of MySQL functions called "MySQL extension".
This extension may be part of the PHP distribution (compiled-in), otherwise it needs to be loaded dynamically.
Its name is probably mysql.so or php_mysql.dll. phpMyAdmin tried to load the extension but failed.

=========================

到這裡應該就沒有很大問題了.如果有配置基礎的朋友應該完全可以理解了.
本人在實際配置的時候也遇到了很多問題.最後都是耐心查詢官方文檔得到瞭解決.



相關文章

Beyond APAC's No.1 Cloud

19.6% IaaS Market Share in Asia Pacific - Gartner IT Service report, 2018

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。