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

来源:互联网 发布:最终幻想7 知乎 编辑:程序博客网 时间:2024/05/16 09:26
这个配置还比较复杂,所以写下来方便以后再用,如果能给别人一些帮助,那是件令人兴奋的事情。
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
http://cceer.xmu.edu.cn/blog/post/apache2.2_php5.html
在此向他/她表示感谢!!!
 
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就好了,很怪,在其他机子上都没有这个问题的。

 

原创粉丝点击