您的位置:首页 > 编程语言 > PHP开发

Windows下搭建x64 PHP的开发测试环境

2015-04-28 18:09 561 查看

Windows下搭建x64 PHP的开发测试环境

由于测试zencart,需要在windows上搭建环境。我喜欢手工搭建开发环境,没有使用WampServer、PHPStudy等的集成开发环境。折腾一下也利于了解各组件使用,关键是自由度高,版本自选。

软件下载

由于官方基本都没有提供x64版本,所以软件都是其他第三方编译提供的,我选择的都是非安装包。

Apache 下载 httpd-win64-2.2.19 msi安装版本

MySQL 下载 MySQL-5.6.16-win64

PHP 下载 php-5.4.12-Win32-VC9-x64

解压整合

将所有软件解压到C盘根目录。如C:\Apache22 , C:\mysql-5.6.15,C:\php-5.4.12-x64

安装httpd、mysql服务

cmd管理员模式进入Apache22\bin,执行:

httpd.exe -k install

进入mysql-5.6.15\bin,执行

mysqld.exe –install mysql –defaults-file=C:\mysql-5.6.15\my.ini

修改配置文件

修改httpd.conf:

ServerRoot “/Apache22” 改为 ServerRoot “C:/Apache22

DocumentRoot “/Apache22/htdocs” 改为 DocumentRoot “D:/PHPWEB
#“D:/PHPWEB” 为zencart的存放目录


紧跟的Deny from all 改为 Allow from all

Directory “/Apache22/htdocs” 改为 Directory “D:/PHPWEB

DirectoryIndex index.html 改为 DirectoryIndex index.php index.html

ScriptAlias /cgi-bin/ “/Apache22/cgi-bin/” 改为 ScriptAlias /cgi-bin/ “C:/Apache22/cgi-bin/

Directory “/Apache22/cgi-bin” 改为 Directory “C:/Apache22/cgi-bin

屏蔽 Include conf/extra/httpd-ahssl.conf,httpd-ahssl.conf文件内的路径都有问题,没有ssl需求可以屏蔽

在LoadModule的最后增加:

LoadModule php5_module “C:/php-5.4.12-x64/php5apache2_2.dll”

PHPIniDir “C:/php-5.4.12-x64”

AddType application/x-httpd-php .php

启动Apache服务:

httpd.exe -k start

修改my.ini:

增加 :

basedir = C:/mysql-5.6.15

datadir = C:/mysql-5.6.15/data

character_set_server = utf8

[mysql] 的default-character-set也保持默认值,改成utf8时,zencart进入后台管理时会报:

WARNING: An Error occurred, please refresh the page and try again.

启动MySQL服务:

net start mysql

增加一个名为zencart的库。

修改php.ini

启用extension_dir =ext” ,并将ext改为”C:/php-5.4.12-x64/ext”

启用几个扩展:

extension=php_curl.dll

extension=php_gd2.dll

extension=php_mbstring.dll

extension=php_mysql.dll

extension=php_mysqli.dll
#zencart需要用此来连接MySQL数据库


extension=php_xmlrpc.dll

配置文件修改完成,重启Apache服务:

httpd.exe -k restart

测试验证

我借用了phpStudy的l.php作为测试用例。



最后是zencart的安装检查页面:



环境搭建完成!!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: