当前位置:首页 > 服务器技术 > apache

apache2.4/24+php5+mysql配置

软件下载

目前,<spanTimes New Roman'">Apache和<spanTimes New Roman'">PHP均未出现官方的<spanTimes New Roman'">64位版本。

Apache 64位:

http://www.blackdot.be/?inc=apache/binaries

这个安装文件我已经上传到csdn的资源空间里面了,大家可以搜索下载!

PHP 64位:

这个安装文件我已经上传到csdn的资源空间里面了,大家可以搜索下载!

MySQL 64位:

http://dev.mysql.com/downloads/mysql/

安装<spanTimes New Roman'">Apache 64

1.解压

将下载的<spanTimes New Roman'">httpd-2.2.17-win64.rar压缩包解压到某一目录下,如<spanTimes New Roman'">D:Apache2.2

2.编辑配置文件<spanTimes New Roman'">D:Apache2.2confhttpd.conf作如下修改【注意路径中必须使用左斜杠】:

ServerRoot "/httpd-2.2-x64"改为

ServerRoot "D:/Apache2.2"

Listen 80改为

Listen 8080 #端口,若已开启<spanTimes New Roman'">IIS,则<spanTimes New Roman'">80端口就不能使用了

DocumentRoot "/httpd-2.2-x64/htdocs"改为

DocumentRoot "D:/Apache2.2/htdocs" #放置网站文件的路径

DirectoryIndex index.html改为

DirectoryIndex index.html index.htm index.php #加入<spanTimes New Roman'">index.php,<spanTimes New Roman'">PHP的默认页

ScriptAlias /cgi-bin/ "/httpd-2.2-x64/cgi-bin/"改为

ScriptAlias /cgi-bin/ "D:/Apache2.2/cgi-bin/"

<Directory "/httpd-2.2-x64/htdocs">改为

<Directory "D:/Apache2.2/htdocs">

<Directory "/httpd-2.2-x64/cgi-bin">改为

<Directory "D:/Apache2.2/cgi-bin">

<spanTimes New Roman'; font-size:10.5pt">LoadModule rewrite_module modules/mod_rewrite.so前的#去掉

3.执行安装命令:

进入<spanTimes New Roman'">D:Apache2.2bin

执行命令:<spanTimes New Roman'">httpd.exe -k install(将<spanTimes New Roman'">apache加入系统服务,默认服务名是<spanTimes New Roman'">Apache2.2)

执行命令:<spanTimes New Roman'">httpd.exe -k start(运行服务<spanTimes New Roman'">)

以后可以使用<spanTimes New Roman'">D:Apache2.2binApacheMonitor.exe进行服务的开启、关闭、重启与监控等操作

4.测试安装是否成功

打开浏览器,输入:http://localhost:8080,显示<spanTimes New Roman'">It Works! 说明成功!

安装<spanTimes New Roman'">PHP 64

1.将下载的<spanTimes New Roman'">php安装包<spanTimes New Roman'">php-5.2.5-x64-2007-11-12.zip中的<spanTimes New Roman'">php-5.2.5 (x64)文件夹复制到某一路径下,如<spanTimes New Roman'">D:PHP

2.修改配置文件<spanTimes New Roman'">D:Apache2.2confhttpd.conf

在<spanTimes New Roman'">#LoadModule vhost_alias_module modules/mod_vhost_alias.so一行下加上:

LoadModule php5_module "D:/PHP/php5apache2_2.dll"

PHPIniDir "D:/PHP"

在<spanTimes New Roman'">AddType application/x-gzip .gz .tgz下加上:

AddType application/x-httpd-php .php

AddType application/x-httpd-php .html #<spanTimes New Roman'; font-size:10.5pt">.html<spanTimes New Roman'; font-size:10.5pt">, .php为可执行php语言的扩展名

3.将如下文件复制到<spanTimes New Roman'">C:WindowsSystem32

D<spanTimes New Roman'; font-size:10.5pt">:PHP<spanTimes New Roman'; font-size:10.5pt">php5ts.dll<spanTimes New Roman'; font-size:10.5pt">
D<spanTimes New Roman'; font-size:10.5pt">:PHP<spanTimes New Roman'; font-size:10.5pt">php5isapi.dll<spanTimes New Roman'; font-size:10.5pt">
D<spanTimes New Roman'; font-size:10.5pt">:PHP<spanTimes New Roman'; font-size:10.5pt">php5apache2_2.dll<spanTimes New Roman'; font-size:10.5pt">
D<spanTimes New Roman'; font-size:10.5pt">:PHP<spanTimes New Roman'; font-size:10.5pt">ext<spanTimes New Roman'; font-size:10.5pt">php_mysql.dll<spanTimes New Roman'; font-size:10.5pt">
D<spanTimes New Roman'; font-size:10.5pt">:PHP<spanTimes New Roman'; font-size:10.5pt">ext<spanTimes New Roman'; font-size:10.5pt">php_mysqli.dll<spanTimes New Roman'; font-size:10.5pt">
D<spanTimes New Roman'; font-size:10.5pt">:PHP<spanTimes New Roman'; font-size:10.5pt">libmysql.dll

4.将<spanTimes New Roman'">D:PHPphp.ini-recommended复制为<spanTimes New Roman'">D:PHPphp.ini,并作如下修改

修改<spanTimes New Roman'">extension_dir = "./"

extension_dir = "ext" #<spanTimes New Roman'; font-size:10.5pt">指定动态连接库的目录

将<spanTimes New Roman'">extension=php_mysql.dll前的分号(注释)去掉

5.测试是否安装成功

修改<spanTimes New Roman'">D:Apache2.2htdocsindex.html文件,加入:<spanTimes New Roman'">

重启<spanTimes New Roman'">httpd服务输入网址:http://loalhost:8080 ,看到<spanTimes New Roman'">php信息,说明成功!

安装<spanTimes New Roman'">MySQL64

不再赘述

安装<spanTimes New Roman'">PhpMyAdmin

1、Apache。

Apache需要64位版本的。http://www.blackdot.be/?inc=apache/binaries,下载那个httpd-2.2.15-win64.rar就可以了。要注意的是这个是blackdot改制成的64位,在赞扬他们默默无闻的奉献精神的同时,也要注意它并非官方的binaries,由此造成的后果应自负(话是这么说,要是有什么明显后果iHenry也不会在这儿写文章了)。

里边没有安装程序。把它解压到一个合适的地方,这里是C:serverhttpd-2.2-x64。请确定有相应的权限。

下面该修改httpd.conf了。这个配置文件,易懂是出了名的。即使没有操作说明,根据其中的英文注释行也能看得懂。但是为了方便起见,还是把要改的说明一下:

ServerRoot “C:/server/httpd-2.2-x64″

ServerName localhost:80

DocumentRoot “C:/server/httpd-2.2-x64/htdocs”

<Directory “C:/server/httpd-2.2-x64/htdocs”>

DirectoryIndex index.html index.htm index.php

ScriptAlias /cgi-bin/ “C:/server/httpd-2.2-x64/cgi-bin/”

按照我的经验,加粗的是要改的。这里的数据都是基于前面确定目录的基础上的,如果用你自己的路径,别忘了写绝对路径,反斜杠()也要改成正斜杠(/)。另外,打开MOD_REWRITE的限制:去掉“LoadModule rewrite_module modules/mod_rewrite.so”前面的#号。

该安装了!用管理员权限进入命令提示符,执行

binhttpd.exe -k install

binhttpd.exe -k start

即可。双击binApacheMoNITor.exe,通过托盘图标控制apache服务的开关。打开浏览器,输入localhost,见证奇迹的时候到了……

2、php。

这是最难的环节。首先是资源难以取得。我找到的参考文档里用的是5.2.5,的确有5.3.0RC4 x64的,但不适用。整个网络里可能就fusionxlan(http://www.fusionxlan.com/PHPx64.php)有x64版的5.2.5,可是fusionxlan.com被墙掉了……不甘心啊,Google文件名,结果在csdn里找到了资源。上传资源的家伙号称用vpn才拿到下载……这里强烈鄙视csdn。名字抄袭msdn,却全无msdn的风格,整个就一娱乐站,下个破文件还想让我注册再扣我的点。没办法,硬着头皮翻墙吧。感谢air-proxy,虽然下载速度被限在40kB/s,但对于一个13M的文件基本够了。下载解压,这里设路径为C:serverphp。

下面要加载一下apache的模组。在LoadModule directives里边,最末尾加上这样几行。

LoadModule php5_module “C:/server/php/php5apache2_2.dll”

AddType application/x-httpd-php .php

PHPIniDir “C:/server/php”

把这些文件拷到system32目录下(无需regsvr32)

C:/server/php/php5ts.dll

C:/server/php/php5isapi.dll

C:/server/php/php5apache2_2.dll

C:/server/php/ext/php_mysql.dll

C:/server/php/libmysql.dll(原文少了一个这个,害的wp老是报错“php似乎没有安装mysql拓展”)

把php.ini-dist拷一个副本,称为php.ini。打开这个文件,修改

extension_dir = “C:/server/php/ext/”

allow_url_fopen = Off

通过去掉分号的方法,加载这些dll。

extension=php_gd2.dll
extension=php_mysql.dll
extension=php_oci8.dll (Oracle数据库)
extension=php_pgsql.dll (postgre 数据库)
extension=php_zip.dll

再对mysql进行一些配置

mysql.default_port = 3306
mysql.default_host = localhost

改一下session.save_path = “C:/tmp”

3、mysql

这个真的最简单。mysql有64位的官方安装版,下面不解释。

4、phpmyadmin和其他。

PMA未经试验,但事实上,给自己用,phpmyadmin纯属没事找事。自己下载官方GUI Tools,用x86的就可以了。

把你的应用程序拷到C:serverhttpd-2.2-x64htdocs,就可以运行了。

以上就介绍了apache2.4/24+php5+mysql配置,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!