PHPStudy下安装Fecshop全过程

文档问题 · censhine · 于 6年前 发布 · 20287 次阅读
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,恭喜您,经历漫长的配置过程终于可以看到结果了!!!

共收到 60 条回复 技术分享 fecshop
kwded#515年前 0 个赞

iis怎么设置呢。

Fecmall#525年前 0 个赞

@kwded #51楼 学习下linux吧,用docker快速部署

cuibin#535年前 0 个赞

你好,请问我用fecshop的百度网盘版下载的fecshop 第四步,db文件以及mongod.cfg 这个没有找到

demo#555年前 0 个赞

我按照步骤一步步走下来 appfront能访问进去 appadmin进不去 ps:已按照论坛解决办法修改store.php执行 但还是这个错 而且前台点页面404找不到界面

Fecmall#565年前 0 个赞

@demo #55楼 如果这个store的问题解决了,如果首页可以访问,其他的页面404,是nginx没有配置去掉index.php,论坛有帖子

如果首页也404,那么是nginx路径配置有问题。

demo#575年前 0 个赞

首页404问题已解决 确实是index.php的问题。但后台界面还是进不去 ps:后台尝试加store也不行,主页都进不去

Fecmall#585年前 0 个赞

出现这个this domain is no config in store component 就是store没有配置好,按照帖子解决

wancq#595年前 0 个赞

您好,我在配置完之后访问页面,出现下图错误: 请问可以帮忙看一下这步是哪出错了吗?

Fecmall#605年前 1 个赞

@wancq #59楼 看报错,应该是没有安装 php-mongodb扩展

注意是php-mongodb扩展, 而不是 php-mongo扩展

wancq#615年前 0 个赞

老师您好,您的项目我包括PC端、移动端、后台全都起起来了。 现在有个小小的问题,就是后台我使用您给的admin/admin123进行登陆,登陆不进去。请问账号是做了修改吗?!

Fecmall#625年前 0 个赞

@wancq [#61楼](#comment61) 默认帐号密码是 admin admin123 , 请检查是否输入了空格

wuliang#634年前 0 个赞

后台登录报错 请问 我这个一登录后台就报错 是应该安装没安装好还是怎么的,Html5入口都没有问题的

wuliang#654年前 0 个赞

请问我这是咋回事呀,昨天都运行好好的,好像每次关机之后再运行就会出现这样的情况。

wuliang#664年前 0 个赞

@Fecshop #60楼 我的也变成这样了!!

Fecmall#674年前 0 个赞

@wuliang #65楼 连接mongodb出错。

添加回复 (需要登录)
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册
Your Site Analytics