Fecshop
作为一款优秀的开源YII2商城,逐渐受到PHP程序员们的青睐。对于这款商城的在LINUX下配置,软件的作者Terry
已经列出了详细的安装文档,讲述非常精细到位,但是对于window下phpstudy[WAMP]环境的安装问题暂时没有讲述,有些初学者对此比较疑惑。
所以笔者今天将以PHPStudy
集成环境下来讲述详细的安装Fecshop的步骤以供不是很清楚的童鞋们参考。
1.下载安装phpstudy,相信大家都很快能安装(不清楚的童鞋请参考其官网,这里不赘述),下载fecshop的百度网盘版,http://pan.baidu.com/s/1hs1iC2C 并解压到你的phpstudy的WWW目录(网速良好者建议composer安装)`;
2.启动phpstudy,建议将PHP版本切换为“php-5.6.27-nts”
,编辑PATH环境变量在后面加入;D:\phpStudy\php\php-5.6.27-nts;
3.下载这个百度网盘的压缩包,链接: https://pan.baidu.com/s/1jI7tDwq 密码: skmm
4.将db
文件夹,和mongod.cfg
(分别为mongodb的数据存储目录和配置文件)复制到D盘根目录下;
5.将第3步下载得到的zip包解压,并安装“Redis-x64-3.2.100.msi”
,“mongodb-win32-x86_64-2008plus-3.4.3-signed.msi”
(都是傻瓜式一键安装,默认下一步即可);
5.1) cmd命令行下执行:
"D:\db\MongoDB\Server\3.4\bin\mongod.exe" --config "D:\mongod.cfg" --install
启动MongoDB服务,执行: net start MongoDB
使用Mongo服务,执行:
"D:\db\MongoDB\Server\3.4\bin\mongo.exe"
use fecshop
5.2) cmd命令行执行开启Redis服务器:
"D:\db\Redis\redis-server.exe" D:\db\Redis\redis.windows.conf
*注意:这里路径D:\db\MongoDB\Server\3.4为您mongodb的安装目录,D:\db\Redis\则为Redis安装目录,请依据实际情况修改!
6.将“php-5.6.27-nts”
文件夹下的ext(内含redis,mangodb的PHP扩展的DLL文件),复制到D:\phpStudy\php\php-5.6.27-nts
下;
7.在您的php.ini
配置文件中加上以下扩展(大约在925
行位置),保存配置并重启phpstudy服务
extension=php_igbinary.dll
extension=php_redis.dll
extension=php_mongodb.dll
8.phpstudy软件上找到其他选项菜单
->打开配置文件
->vhosts-conf
并在末尾添加以下配置:
<VirtualHost *:80>
DocumentRoot "D:\phpStudy\WWW\fecshop\appadmin\web"
ServerName appadmin.fecshoptest.com
ServerAlias appadmin.fecshoptest.com
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "D:\phpStudy\WWW\fecshop\appfront\web"
ServerName appfront.fecshoptest.com
ServerAlias appadmin.fecshoptest.com
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "D:\phpStudy\WWW\fecshop\appserver\web"
ServerName appserver.fecshoptest.com
ServerAlias appserver.fecshoptest.com
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "D:\phpStudy\WWW\fecshop\appapi\web"
ServerName appapi.fecshoptest.com
ServerAlias appadmin.fecshoptest.com
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "D:\phpStudy\WWW\fecshop\apphtml5\web"
ServerName apphtml5.fecshoptest.com
ServerAlias apphtml5.fecshoptest.com
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "D:\phpStudy\WWW\fecshop\appimage\common"
ServerName img.fecshoptest.com
ServerAlias img.fecshoptest.com
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "D:\phpStudy\WWW\fecshop\appimage\appadmin"
ServerName img2.fecshoptest.com
ServerAlias img2.fecshoptest.com
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "D:\phpStudy\WWW\fecshop\appimage\appfront"
ServerName img3.fecshoptest.com
ServerAlias img3.fecshoptest.com
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "D:\phpStudy\WWW\fecshop\appimage\apphtml5"
ServerName img4.fecshoptest.com
ServerAlias img4.fecshoptest.com
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "D:\phpStudy\WWW\fecshop\appimage\appserver"
ServerName img5.fecshoptest.com
ServerAlias img5.fecshoptest.com
</VirtualHost>
9.phpstudy软件上找到其他选项菜单
->打开hosts
,在尾部添加以下解析:
127.0.0.1 rock.fecshoptest.com # rockmongo的域名指向,rockmongo是mongodb的可视化界面,类似于mysql的phpmyadmin
127.0.0.1 my.fecshoptest.com # mysql的phpmyadmin的域名指向
127.0.0.1 appadmin.fecshoptest.com # 后台域名指向
127.0.0.1 appfront.fecshoptest.com # 前台pc端域名指向
127.0.0.1 apphtml5.fecshoptest.com # 前台html端的域名指向
127.0.0.1 appapi.fecshoptest.com # api端的域名指向
127.0.0.1 appserver.fecshoptest.com # server端的域名指向
127.0.0.1 img.fecshoptest.com #appimage/common 图片的域名指向
127.0.0.1 img2.fecshoptest.com #appimage/appadmin 图片的域名指向
127.0.0.1 img3.fecshoptest.com #appimage/appfront 图片的域名指向
127.0.0.1 img4.fecshoptest.com #appimage/apphtml5 图片的域名指向
127.0.0.1 img5.fecshoptest.com #appimage/appserver图片的域名指向
10.重启phpstudy服务,然后cmd命令行:
cd /d D:\phpStudy\WWW\fecshop
init
选择对应生产环境或测试环境序号完成初始化;
11.找到D:\phpStudy\WWW\fecshop\common\config\main-local.php
修改其中的mysql,redis等配置信息;
12.找到D:\phpStudy\WWW\fecshop\appfront\config\fecshop_local_services\Store.php
修改成如下:
return [
'store' => [
'class' => 'fecshop\services\Store',
'stores' => [
// store key:域名去掉http部分,作为key,这个必须这样定义。
'appfront.fecshoptest.com' => [
'language' => 'en_US', // 语言简码需要在@common/config/fecshop_local_services/FecshopLang.php 中定义。
'languageName' => 'English', // 语言简码对应的文字名称,将会出现在语言切换列表中显示。
'localThemeDir' => '@appfront/theme/terry/theme01', // 设置当前store对应的模板路径。关于多模板的方面的知识,您可以参看fecshop多模板的知识。
'thirdThemeDir' => [], // 第三方模板路径,数组,可以多个路径
'currency' => 'USD', // 当前store的默认货币,这个货币简码,必须在货币配置中配置
/*
* 当设备满足什么条件的时候,进行跳转。
* 这种方式不怎么高效,最好的方式是在nginx中配置。
*/
'mobile' => [
'enable' => false,
'condition' => ['phone', 'tablet'], // phone 代表手机,tablet代表平板
'redirectDomain' => 'apphtml5.fecshoptest.com', // 如果是移动设备访问进行域名跳转,这里填写的值为store key
],
// 第三方账号登录配置
'thirdLogin' => [
// facebook账号登录
'facebook' => [ //fb api配置 ,fb可以一个app设置pc和手机web两个域名
'facebook_app_id' => '108618299786621',
'facebook_app_secret' => '420b56da4f4664a4d1065a1d31e5ec73',
],
// google账号登录
'google' => [ //谷歌api visit https://code.google.com/apis/console to generate your google api
'CLIENT_ID' => '380372364773-qdj1seag9bh2n0pgrhcv2r5uoc58ltp3.apps.googleusercontent.com',
'CLIENT_SECRET' => 'ei8RaoCDoAlIeh1nHYm0rrwO',
],
],
// 用于sitemap生成中域名。
'https' => true,
// sitemap的路径。
'sitemapDir' => '@appfront/web/sitemap.xml',
],
'apphtml5.fecshoptest.com/fr' => [
'language' => 'fr_FR',
'languageName' => 'Français',
'localThemeDir' => '@appfront/theme/terry/theme01',
'thirdThemeDir' => [],
'currency' => 'RMB',
'mobile' => [
'enable' => false,
'condition' => ['phone'], // phone 代表手机,tablet代表平板。
'redirectDomain' => 'apphtml5.fecshoptest.com/fr', // 跳转后的url。
],
// 第三方账号登录配置
'thirdLogin' => [
// facebook账号登录
'facebook' => [ //fb api配置 ,fb可以一个app设置pc和手机web两个域名
'facebook_app_id' => '108618299786621',
'facebook_app_secret' => '420b56da4f4664a4d1065a1d31e5ec73',
],
// google账号登录
'google' => [ //谷歌api visit https://code.google.com/apis/console to generate your google api
'CLIENT_ID' => '380372364773-qdj1seag9bh2n0pgrhcv2r5uoc58ltp3.apps.googleusercontent.com',
'CLIENT_SECRET' => 'ei8RaoCDoAlIeh1nHYm0rrwO',
],
],
'sitemapDir' => '@appfront/web/fr/sitemap.xml',
],
'apphtml5.fecshoptest.com/es' => [
'language' => 'es_ES',
'languageName' => 'Español',
'localThemeDir' => '@appfront/theme/terry/theme01',
'thirdThemeDir' => [],
'currency' => 'USD',
'mobile' => [
'enable' => false,
'condition' => ['tablet'],
'redirectDomain' => 'apphtml5.fecshoptest.com/es',
],
// 第三方账号登录配置
'thirdLogin' => [
// facebook账号登录
'facebook' => [ //fb api配置 ,fb可以一个app设置pc和手机web两个域名
'facebook_app_id' => '108618299786621',
'facebook_app_secret' => '420b56da4f4664a4d1065a1d31e5ec73',
],
// google账号登录
'google' => [ //谷歌api visit https://code.google.com/apis/console to generate your google api
'CLIENT_ID' => '380372364773-qdj1seag9bh2n0pgrhcv2r5uoc58ltp3.apps.googleusercontent.com',
'CLIENT_SECRET' => 'ei8RaoCDoAlIeh1nHYm0rrwO',
],
],
'sitemapDir' => '@appfront/web/sitemap_es.xml',
],
'apphtml5.fecshoptest.com/cn' => [
'language' => 'zh_CN',
'languageName' => '中文',
'localThemeDir' => '@appfront/theme/terry/theme01',
'thirdThemeDir' => [],
'currency' => 'CNY',
'mobile' => [
'enable' => false,
'condition' => ['phone', 'tablet'],
'redirectDomain' => 'apphtml5.fecshoptest.com/cn',
],
// 第三方账号登录配置
'thirdLogin' => [
// facebook账号登录
'facebook' => [ //fb api配置 ,fb可以一个app设置pc和手机web两个域名
'facebook_app_id' => '108618299786621',
'facebook_app_secret' => '420b56da4f4664a4d1065a1d31e5ec73',
],
// google账号登录
'google' => [ //谷歌api visit https://code.google.com/apis/console to generate your google api
'CLIENT_ID' => '380372364773-qdj1seag9bh2n0pgrhcv2r5uoc58ltp3.apps.googleusercontent.com',
'CLIENT_SECRET' => 'ei8RaoCDoAlIeh1nHYm0rrwO',
],
],
'sitemapDir' => '@appfront/web/cn/sitemap.xml',
],
],
],
];
13.
测试数据下载地址为:https://pan.baidu.com/s/1kVwRD2Z , 进入后下载文件夹:fecshop数据测试包 ,这个文件夹里面所有的文件。
建立mysql数据库fecshop。
cmd命令行执行:
yii migrate --interactive=0 --migrationPath=@fecshop/migrations/mysqldb
导入mysql_fecshop.sql
测试数据到mysql
导入mongodb的表,数据,索引:
yii mongodb-migrate --interactive=0 --migrationPath=@fecshop/migrations/mongodb
导入mongodb测试数据:
D:\db\MongoDB\Server\3.4\bin\mongo 127.0.0.1:27017/fecshop --quiet "D:\phpStudy\WWW\fecshop\mongo-fecshop_test-20170419-065157.js"
14.在D:\phpStudy\WWW\fecshop\appfront\web
文件夹下建立.htaccess
并录入以下信息
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]
</IfModule>
15.浏览器打开http://appfront.fecshoptest.com
,恭喜您,经历漫长的配置过程终于可以看到结果了!!!