sitrunlab/learnzf2

学习ZF2网站

安装: 33

依赖项: 0

建议者: 0

安全性: 0

星标: 19

关注者: 9

分支: 14

开放问题: 4

类型:项目

0.1.4 2015-11-23 21:02 UTC

This package is auto-updated.

Last update: 2024-09-05 18:46:32 UTC


README

Build Status Coverage Status Scrutinizer Code Quality SensioLabsInsight

简介

这是一个“学习Zend Framework”网站的存储库,其中包含可以直接查看或下载的实时模块。

安装

1. 使用Composer

$ composer create-project sitrunlab/learnzf2

2. 使用Bower安装资产依赖项。安装NodeJs并运行

sudo npm install -g bower
bower install

3. 这是Bower安装过程的输出。

bower install
-----------------------------------------
Update available: 1.3.9 (current: 1.3.7)
Run npm update -g bower to update
-----------------------------------------

bower bootstrap#3.0.3           cached git://github.com/twbs/bootstrap.git#3.0.3
bower bootstrap#3.0.3         validate 3.0.3 against git://github.com/twbs/bootstrap.git#3.0.3
bower jquery#1.10.2             cached git://github.com/jquery/jquery.git#1.10.2
bower jquery#1.10.2           validate 1.10.2 against git://github.com/jquery/jquery.git#1.10.2
bower jquery-ui#1.10.3          cached git://github.com/components/jqueryui.git#1.10.3
bower jquery-ui#1.10.3        validate 1.10.3 against git://github.com/components/jqueryui.git#1.10.3
bower selectize#0.8.5           cached git://github.com/brianreavis/selectize.js.git#0.8.5
bower selectize#0.8.5         validate 0.8.5 against git://github.com/brianreavis/selectize.js.git#0.8.5
bower sifter#0.3.x              cached git://github.com/brianreavis/sifter.js.git#0.3.3
bower sifter#0.3.x            validate 0.3.3 against git://github.com/brianreavis/sifter.js.git#0.3.x
bower microplugin#0.0.x         cached git://github.com/brianreavis/microplugin.js.git#0.0.3
bower microplugin#0.0.x       validate 0.0.3 against git://github.com/brianreavis/microplugin.js.git#0.0.x
bower sifter#0.3.x                 new version for git://github.com/brianreavis/sifter.js.git#0.3.x
bower sifter#0.3.x             resolve git://github.com/brianreavis/sifter.js.git#0.3.x
bower sifter#0.3.x            download https://github.com/brianreavis/sifter.js/archive/v0.3.4.tar.gz
...

检查Bower是否安装成功

bower -version

输出应如下所示

bower -version
1.3.3

[可选] 如果没有输出,请尝试安装nodejs-legacy

sudo apt-get install nodejs-legacy

4. 将config/autoload/doctrine.local.php.dist复制到config/autoload/doctrine.local.php,并使用您的当前环境进行配置。

5. 运行doctrine迁移

vendor/bin/doctrine-module migrations:migrate

Web服务器设置

PHP CLI服务器

在PHP 5.4或更高版本中开始的最简单方法是运行此脚本

php -S 0.0.0.0:8080 -t public/ public/index.php

上面的脚本将在端口8080上启动"cli-server",并影响所有网络接口。

警告:内置的CLI-Server仅适用于开发!

Apache设置

<VirtualHost *:80>
    ServerName learnzf2.localhost
    DocumentRoot /path/to/LearnZF2/public
    SetEnv APPLICATION_ENV "development"
    <Directory /path/to/learnzf2.localhost/public>
        DirectoryIndex index.php
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

Nginx设置

创建一个名为"learnzf2.localhost"的新文件

sudo gedit /etc/nginx/sites-available/learnzf2.localhost

并填充以下脚本。

server {
      listen      80;
      server_name learnzf2.localhost;
      root        /path/to/LearnZF2/public;
      index       index.html index.htm index.php;

      location / {
        try_files $uri $uri/ /index.php$is_args$args;
      }

      location ~ \.php$ {
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include        fastcgi_params;
      }
}

创建到"sites-enabled"目录的符号链接

sudo ln -s /etc/nginx/sites-available/learnzf2.localhost /etc/nginx/sites-enabled/learnzf2.localhost

重启Nginx服务。

sudo service nginx restart

注意:别忘了在主机文件中添加一个"虚拟主机名"。

Windows中主机文件的位置是

C:\Windows\System32\Drivers\etc\hosts

Linux中主机文件的位置是

sudo gedit /etc/hosts

并添加此行

127.0.0.1 learnzf2.localhost