Windows 2003下Apache_2.2 + php + MySQL + SmartFoxServer的配置

這個配置還比較複雜,所以寫下來方便以後再用,如果能給別人一些幫助,那是件令人興奮的事情。
1.下載需要的軟件
1.1 Apache_2.2的windowsMSI版本(安裝版本),如:apache_2.2.6-win32-x86-no_ssl_PConline.msi
    1.2 PHP5的Zip包下載(別下安裝版本,用模塊模式比CGI模式效率好),如:php-5.2.4-Win32.zip
1.3 MySQL安裝程序
1.4 SmartFoxServer

 
2.配置Apache_2.2
安裝apache_2.2.6-win32-x86-no_ssl_PConline.msi,很順利的成功了,打開apache_2_2/conf文件夾下的httpd.conf文件,修改“Listen 80”爲“Listen 8086”(這裏我用8086端口,可以設置爲系統常用端口之外的任意端口),重啓Apache_2.2,在瀏覽器中輸入,http://localhost:8086,如果出現“Itworks!”表示Apache服務器初步配置成功。
   
3.配置PHP
解壓PHP5壓縮包,比如解壓到E:/php。
複製E:/php/php.ini-recommended到系統盤的windows文件夾下,重命名爲php.ini。打開php.ini,修改extension_dir值爲E:/php/ext(即extension_dir="E:/php/ext")
   複製E:/php下需要的dll到系統盤的system32下(這個根據不同系統而定,有的是system文件夾等等),這裏我只複製了php5ts.dlllibmysql.dll 
   修改httpd.conf
   網上普遍用這個方法:在模塊段(#LoadModulessl_module modules/mod_ssl.so後)添加下面兩句:
  1. ###------------------------------------------###
  2.     LoadModule php5_module "E:/php/php5apache2_2.dll"  #指定模塊
  3.     AddType application/x-httpd-php .php      #這個只是指定MIME
  4. ###------------------------------------------###

注意:要將代碼後面的中文去掉
將DirectoryIndex設置爲: 
DirectoryIndex   index.php  index.htm   index.html

   這樣重啓Apache,寫個文件(hello_world.php)

<?php
    echo("hello,world");
    ?>
丟到默認的Web主目錄(apache_2_2/htdocs),測試:
    用
http://localhost:8086/hello_world.php訪問成功輸出hello,world
 
參考網站:草履蟲的BLOG
在此向他/她表示感謝!!!
 
4.安裝MySQL
將mysql安裝到指定目錄(我直接裝在默認目錄下),然後安裝程序會引導你一步步配置。具體如下:
a.雙擊該圖標(先保證你的電腦上安裝了WinRAR或者WinZIP等解壓縮工具,壓縮工具也可以在上面的頁面中下載到),打開rar解壓窗口。你可以把文件解壓都硬盤上,然後再安裝。也可以直接在窗口中,雙擊Setup.exe文件,開始mysql5.0的安裝。先是等待,它自己解壓文件。
b.直到出現安裝歡迎程序,點擊Next開始下一步安裝。默認是Typical,建議改成Custom,因爲Typical模式不允許改變安裝路徑,只能安裝在C盤。下面會介紹Custom的安裝方法,到這一步需要選擇組件及更改文件夾位置,組件就用默認的,位置可以選擇Change來改變,注意:安裝mysql的路徑中,不能含有中文!
一切就緒,點擊Install開始安裝。
    c.開始安裝過程,會出現安裝進度條,安裝結束後,程序會提示是否要在mysql.com上註冊,我們選擇跳過,即SkipSign-Up然後點“Next”(大膽地跳過,不要緊的)
    d.安裝結束,選擇現在開始配置mysql服務器。點擊Finish繼續。 
e. 配置開始,點擊Next繼續,
f. 選擇DetailedConfiguration,點Next繼續。下面這個選項是選擇mysql應用於何種類型,第一種是開發服務器,將只用儘量少的內存,第二種是普通WEB服務器,將使用中等數量內存,最後一種是這臺服務器上面只跑mysql數據庫,將佔用全部的內存,我這裏只是示例,就選擇開發服務器,佔用儘量少的內存,用戶可根據自己的需求,選擇其他選項,點Next繼續
    g.下面是選擇數據庫用途,第一種是多功能用途,將把數據庫優化成很好的innodb存儲類型和高效率的myisam存儲類型,第二種是隻用於事務處理類型,最好的優化innodb,但同時也支持myisam,最後一種是非事務處理類型,適合於簡單的應用,只有不支持事務的myisam類型是被支持的。一般選擇第一種多功能的。點Next繼續,
h.下面是選擇InnodDB的數據存放位置,一般默認好了,不需要改動,
i.下面是選擇mysql允許的最大連接數,第一種是最大20個連接併發數,第二種是最大500個併發連接數,最後一種是自定義,你可以根據自己的需要選擇,點Next繼續,
j.下面是選擇數據庫監聽的端口,一般默認是3306,如果改成其他端口,以後連接數據庫的時候都要記住修改的端口,否則不能連接mysql數據庫,比較麻煩,這裏不做修改,用mysq的默認端口:3306,點Next繼續,
k.這一步設置mysql的默認編碼,默認是latin1,我們可以根據需要,把它改成gb2312,或gbk,注意:如果要用原來數據庫的數據,最好能確定原來數據庫用的是什麼編碼,如果這裏設置的編碼和原來數據庫數據的編碼不一致,在使用的時候可能會出現亂碼。點Next繼續,
l.這一步是是否要把mysql設置成windows的服務,一般選擇設成服務,這樣以後就可以通過服務中啓動和關閉mysql數據庫了。推薦:下面的複選框也勾選上,這樣,在cmd模式下,不必非到mysql的bin目錄下執行命令,點Next繼續,
m.這一步是設置mysql的超級用戶密碼,這個超級用戶(即root用戶)非常重要,對mysql擁有全部的權限,請設置好並牢記超級用戶的密碼,下面有個複選框是選擇是否允許遠程機器用root用戶連接到你的mysql服務器上面,如果有這個需求,也請勾選,當兩次輸入的密碼一致後,記住該密碼(很重要,後面配置時要用),點Next繼續,
    n.到現在位置,mysql已經得到了足夠的配置條件,如果沒有問題即可點擊Execute,讓mysql進行配置,如果有不妥的地方,點擊Back,重新修改配置條件,
    o.這樣mysql就全部安裝好了,可能出現的問題:
   如果在第m步,你出現的界面有三個輸入密碼的地方,則有可能您是在原來基礎上安裝的。你在第一個文本框輸入原來root的密碼,後面兩個文本框輸入root的新密碼,點擊Next基礎,
給您推薦幾種解決辦法:
1、       點Retry,重試;
2、       再運行一次設置,看到有關“移除原設置”的選項,選擇移除,然後在重新設置。
3、       重裝。
重裝注意事項:最好刪除原來的所有文件,必要的話,可以清一下註冊表,如果你機器上沒有其它mysql相關的程序。而且一定記得不要保留原有的my.ini文件。還有就是刪除原來安裝路徑下的文件,並刪除數據目錄下面的ibdata1文件.
測試MySQL安裝是否成功:開始菜單|MySQL|MySQL Server5.0|MySQL Command Line Client|輸入第m步記住的密碼,如果出現Welcometo MySQL monitor,Command end with ;or/g....等則表示MySQL已經安裝成功。
5.配置php.ini並測試mysql
在C:/WINDOWS/下打開php.ini文件,找到extension_dir = "./"改爲extension_dir = "e:/php/ext"
找到
;extension=php_dba.dll
    ;extension=php_dbase.dll
;extension=php_gd2.dll
;extension=php_imap.dll
;extension=php_mysql.dll
   將前面的';'都去掉
找到
   ;session.save_path = "/tmp"
    將';'去掉設置你保存session的目錄,如
    session.save_path= "e:/php/session_temp"
 
接下來修改了一些文件上傳以及內存使用最大限制:
   post_max_size = 20M
   upload_max_filesize = 20M
在Web的根目錄htdocs文件夾下建個testdb.php文件內容如下:
   <?php
   $link=mysql_connect('localhost','root','123456');
    if(!$link)echo "fail";
    else echo"success";
   mysql_close();
    ?>
重啓Apache服務器,用瀏覽器打開“http://localhost:8086/testdb.php”如果輸出success就OK了。
 
6.phpmyadmin的安裝配置
將phpMyAdmin-2.11.1.2-all-languages.zip解壓到WEB根目錄htdocs中去,重命名文件夾爲phpmyadmin。在此文件夾裏將config.sample.inc.php改名爲config.inc.php並修改裏面的參數,不然mysql是連不上的。

具體參數修改【config.inc.php】:
   $cfg['blowfish_secret'] = '123456';

$cfg['Servers'][$i]['controluser'] ='root';
   $cfg['Servers'][$i]['controlpass'] = '123456';

需要的話重啓下MySQL,用瀏覽器打開“http://localhost:8086/phpmyadmin”,出現登錄界面就OK了。

 

參考網站:1.http://bbs.mysql.cn/thread-261-1-1.html          

         2.小空間 大智慧

http://hi.baidu.com/webarea/blog/item/4db9e1103af09403213f2e18.html

         3.夜雨闌珊

http://hi.baidu.com/372179111/blog/item/17c338d5e0f38ac751da4bb3.html

在此表示感謝!!!

 

7.配置SmartFoxServer

7.1 System requirements

SmartFoxServer is a multi-platform applicationwritten in Java 1.4 that can be run on many different operatingsystems.

The minimum requirements to run the serverare:

- A 300Mhz cpu or better
    - At least64Mb of RAM
    - 50Mb ofhardisk space
    - Anoperating system capable of running a Java Virtual Machine (JVM)like Windows (98/NT/2000/XP), Linux, MacOS X, other Unix basedOS(es)
    - The Sun"Java Runtime Edition (JRE) version 1.4.2 or higher.
(The PRO edition requires Java 1.5 - Linux versions already comewith an embedded JRE)

Reccomended basic hardwarerequirements:

- 800Mhz or higher CPU
    - 256MbRAM

Reccomended hardware requirements for hightraffic applications and games:

- Dual 2.0Ghz CPU or higher
    - 1GbRam
    - Serverversion of the Sun JVM

 

7.2 Installing the Java Runtime

In order to install or upgrade your Java Runtime, pleasefollow thislink.

 

7.3 Installing on Windows (NT/2K/XP/2003)

Double click on the installer and follow the simple instructionson screen.
    When theprocess is finished you will find a newSmartFoxServer folder under the Start >Programs menu where you can launch the server and accessthe other application folders.

   InstallingSmartFoxServer as a Windows Service:
From the Windows Start Menu open the SmartFoxServer folderand click on the Install Service icon to installSmartFoxServer as a windows service. Once this is done you willfind it listed in the windows services under the managementconsole. 
    You can nowstart/stop/restart the server following these steps:
    1.Right-click My Computer, and chooseManage.
    2. Expandthe Services & Applications tab, and selectServices.
    3. SelectSmartFoxServer and use the control buttons or right click on it toaccess the context menu.

    In order touninstall the server as a service just click the UninstallService icon from the Start > Programs >SmartFoxServer menu.

7.4 Flash API installation

To complete the setup you will need to install theSmartFoxServer API extension forAdobe Flash.
The extension will add new objects that you can use in Actionscriptto interact with the server.

To install the API just open the Flash API/folder in your SFS main directory and choose the appropriateversion.

» Flash MX 2004 - Flash8

Simply double click the Actionscript2.0/SmartFoxClient_AS2.mxp file to launch the ExtensionManager and install the component.
Alternatively you can point the Flash classpath of your currentproject to the sources/AS2/ folder.

» Flex Builder 2 /Flash 9 alpha

Add the provided SmartFoxClient_AS3.swc libraryfile to your current project build path.
In Flex Builder right click the project icon, chooseproperties >> FlexBuild Path >> LibraryFile >> AddSWC...
If you want to use the JSON based protocol, add also the Adobecorelib.swc library file.

 

7.5 API documentation

For more info about the Flash Client API, please refer tosection 4.1, and section 4.2 of this documentation.

    In case youneed to upgrade your Adobe Extension Manager please
download the latest version.


補充:

問題1,PHP Parse Error: syntax error, unexpected $end 解決方法:

12In PHP 5, the following error may appears as an error entry in Apache error log or simply displays on PHP web page, even if calling to php scripts with php_info() works perfectly and successfully returns information on PHP configurations:

Parse Error: syntax error, unexpected $end in ….. scripts.php on line …

The error may caused by a missing curly bracket in PHP script coding. Beside, it may also caused by error in PHP coding in class definition, as in PHP, a class definition cannot be broke up and distributed into multiple files, or into multiple PHP blocks, unless the break is within a method declaration.

But more commonly, the error is often caused by the use of Short Open tags in PHP,

To use short open tags, it must be enabled in PHP.INI. Search for short_open_tag in PHP.INI, and change the value to On. The line should look line:

short_open_tag = On

注意:php.ini中像short_open_tag標籤不止一個,所以修改時一定要確保有一個修改爲On,而其他的都被註釋掉了. 

 

補充2:phpmyadmin安裝在htdocs目錄下。輸入http://localhost/phpmyadmin顯示頁面如下:   Index  of  /phpMyAdmin等  

原因:原因是你的目錄是可以瀏覽的,其次是沒有指定index.php爲默認首頁

將http.conf設置爲:  
   DirectoryIndex   index.php  index.htm   index.html

 

補充3:php配置的問題Fatal error: Call to undefined function mysql_connect()

extension=php_mysql.dll的;去掉了

把php5ts.dll,libmysql.dll 拷到 system32系統目錄裏了

extension_dir = "D:/php/ext 也改了

但就是連不上。

解決方法:將extension_dir = "D:/php/ext ";改爲
    extension_dir = "D:/php/ext ";
    重啓Apache和MySQL就好了,很怪,在其他機子上都沒有這個問題的。

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章