本方法基于:ZendFramework 2.1.4版本在WIN7下构建,其他版本的安装方式相差不大。
操作之前您需要搭建好PHP运行环境,保证PHP版本不低于PHP 5.3.3,并且去http://framework.zend.com/downloads/latest下载好ZF2的library。

方式一,最简单方便的安装方式

直接去https://github.com/zendframework/ZendSkeletonApplication下载项目文件,然后把下载的ZF2中的library所有文件直接拷贝到vendor/ZF2目录中(目录格式为vendor\ZF2\library\Zend\)。

方式2. 官方推荐安装方式

1. 下载ZendFramework-2.1.4,提取其中的zend目录。

2. 在php.ini中添加 include_path = “.;c:\你的目录\Zend”。

(此处 建立虚拟目录啊、改HOSTS文件什么的都不详解了)

3. 此时可以去https://github.com/zendframework/ZendSkeletonApplication下载使用了,但是直接访问的时候的时间提示

Fatal error: Uncaught exception 'RuntimeException' with message 'Unable to load ZF2. Run `php composer.phar install` or define a ZF2_PATH environment variable.' in...

4. 我们直接采用设置ZF2_PATH环境的方法。找到http.conf 文件 添加SetEnv ZF2_PATH “C:/<你的ZF2框架目录>”(注意这里不需要添加路径zend)。

方式3: 在线安装

1. 直接去https://github.com/zendframework/ZendSkeletonApplication下载运行。

2. 这时候我们选择php composer.phar install 的方式来安装,用CMD进入到composer.phar所在目录执行 php composer.phar install ,这时候可能会出现两种错误

一种是:

'php' 不是内部或外部命令,也不是可运行的程序或批处理文件。 

很显然是没有找到PHP环境,这时候自己去配置好环境就行(怎么配置PHP环境变量?打开“我的电脑”->“属性”->“高 级”->“环境变量”->“系统变量”->“path”,编辑其值,添加你的PHP所有路径就行了),要是觉得麻烦我试了下把整个 PHP的运行文件复制到目录下也能行(当然不推荐这样,太乱了)。

另一种是:

This dev build of composer is outdated, please run "composer.phar self-update" t
o get the latest version.
Loading composer repositories with package information
Installing dependencies
- Installing zendframework/zendframework (2.1.4) [RuntimeException]
You must enable the openssl extension to download files via https install [--prefer-source] [--dry-run] [--dev] [--no-custom-installers] [--no-scr
ipts] [-v|--verbose]

此时只需要开启php.ini中的extension=php_openssl.dll就行了

3 .要是出现

This dev build of composer is outdated, please run "composer.phar self-update" t
o get the latest version.
Loading composer repositories with package information
Installing dependencies
- Installing zendframework/zendframework (2.1.4)
Downloading: 100% zendframework/zendframework suggests installing doctrine/common (Doctrine\Common
>=2.1 for annotation features)
zendframework/zendframework suggests installing ext-intl (ext/intl for i18n feat
ures)
zendframework/zendframework suggests installing ircmaxell/random-lib (Fallback r
andom byte generator for Zend\Math\Rand if OpenSSL/Mcrypt extensions are unavail
able)
zendframework/zendframework suggests installing pecl-weakref (Implementation of
weak references for Zend\Stdlib\CallbackHandler)
zendframework/zendframework suggests installing zendframework/zendpdf (ZendPdf f
or creating PDF representations of barcodes)
zendframework/zendframework suggests installing zendframework/zendservice-recapt
cha (ZendService\ReCaptcha for rendering ReCaptchas in Zend\Captcha and/or Zend\
Form)
Writing lock file
Generating autoload files

就说明已经安装成功了,此中方法不需要添加php include_path ,也不需要向添加ZF2_PATH环境。

至此PHP的安装算是基本上完成了

下面讲进行一些相关的配置:

1. 配置apache

1.1开启URL重写功能
1.2 配置虚拟目录

<VirtualHost *:80>
ServerName zf2.localhost
DocumentRoot zf2项目路径/public
SetEnv APPLICATION_ENV "development"
<Directory zf2项目路径/public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

1.3 将域名zf2.localhost指向本机,在hosts文件(路径:c:\windows\system32\drivers\etc\hosts)中添加

127.0.0.1 zf2.localhost

此时通过域名zf2.localhost就可以直接访问到你的项目了。

解决ZF2_PATH environment的更多相关文章

  1. zendframework 2

    我想我的生活需要新的挑战 zf2整个框架里面都应用了namespace,并且他的每个模块,我们都可以根据自己的需要去命名路径,对我来说,zf2的模块化更加的清晰,对于外包来说,或许很方便. 创建他,我 ...

  2. oracle学习笔记(四)oracle内存优化

    emca -config dbcontrol db -repos recreate 解决'oracle Environment variable ORACLE_SID not defined. Ple ...

  3. ZendFramework2 源码分析 init_autoloader.php

    // Composer autoloading if (file_exists('vendor/autoload.php')) { // 加载自动加载器 $loader = include 'vend ...

  4. ZendFramework 环境部署

    查看源码 int_autoloader.php 文件中,发现应用了一个 AutoloaderFactory 的命名空间,路径写得是相对路径,所以需要在 php.ini 中定义一个 inclde_pat ...

  5. sonar + jacoco + mockMvc 模拟session 用户登录 配合SpringSecurity 权限 快速测试代码覆盖率.

    遇到mock 测试简直就是神器,特别是要做代码覆盖率,直接测试controller就好了,缺点,虽然可以回滚事务,但是依赖数据库数据,解决,根据SpringBoot ,再建立一个专门跑单元测试的数据库 ...

  6. celery和supervisor配合使用,实现supervisor管理celery进程

    在这里我选择redis作为celery异步任务的中间人,系统选择CentOS6.5 64位.redis.celery和supervisor的安装参见官方文档. 安装完毕后: 1, 创建celery的实 ...

  7. celery Django 简单示例

    一.目录结构 二.创建worker文件夹 __init__.py # -*- coding:utf-8 -*-import osfrom celery import Celery, platforms ...

  8. Oracle客户端工具出现“Cannot access NLS data files or invalid environment specified”错误的解决办法

    Oracle客户端工具出现"Cannot access NLS data files or invalid environment specified"错误的解决办法 方法一:参考 ...

  9. 教新手一步步解决:Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable to和更新gradle问题

    android studio出现问题:Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_O ...

随机推荐

  1. JavaEE(9) - Session EJB的生命周期、事务及拦截器

    1. SessionBean的生命周期 无状态Session Bean: 不存在状态-->待命状态-->被销毁状态 不存在状态-->待命状态: 1)通过构造器创建EJB实例 2)执行 ...

  2. Skynumber

    Time Limit: 1000ms Memory Limit: 128000KB 64-bit integer IO format:      Java class name: Submit Sta ...

  3. 使用 CodeIgniter 框架快速开发 PHP 应用(七)

    原文:使用 CodeIgniter 框架快速开发 PHP 应用(七) CodeIgniter 和对象这是玩家章节.它讲述的是 CodeIgniter 的工作原理,也就是揭开CI头上'神秘的面纱'.如果 ...

  4. win8 64位使用plsql developer连接oracle数据库问题

    问题:win8的64使用位系统plsql developer本地连接oracle莫名其妙的问题发生在数据库时.错误消息框,甚至可能是空的. 原因:它表示,互联网,的原因,预计在64位系统安装在64位O ...

  5. freemarker定义自己的标记(三)-nested说明

    freemarker定义自己的标记 1.nested指令 是可选的,能够在<#macro>和</#macro>之间使用在不论什么位置和随意次数 2.演示样例说明 <#ma ...

  6. 交易应用-运行多个SQL声明

    事务具有原子性.要么不运行.要么全运行.一旦成功运行永久保存.而这些正是因为事务的原子性和对数据库的持久性形成的.下面是一个关于统一给数据库中的数据改动的批量操作,利用到事务. TODO:批量改动数据 ...

  7. 纠错《COM技术内幕》之ProgID

    近期在看<COM技术内幕>,看到第六章时发现该章节在解释ProgID时有点错误,特此记录一下,也给正在学习COM的小伙伴们一个提示. 并且我发现该问题存在于一些非常多大型软件的COM组件中 ...

  8. Java设计模式(八)观察者模式 迭代器模式

    (十五)观察者模式 观察者模式,定义对象间一对多关系,一个对象状态发生改变,全部依赖于它的对象都收到通知而且自己主动更新,观察者与被观察者分开.比如邮件订阅.RSS订阅,假设有更新就会邮件通知你. i ...

  9. Cocos2d-x学习笔记(14)(更新函数scheduleUpdate、进度计时器CCProgressTo、滚动视图CCScrollView)

    一.scheduleUpdate 1.scheduleUpdate:此函数是CCNode的函数,每一个CCNode仅仅要调用scheduleUpdate更新函数,那么这个CCNode就会响应当前类的u ...

  10. [Unity3D]Unity3D连衣裙实现游戏开发系统

    大家好,我是秦培.欢迎关注我的博客,我的博客地址">blog.csdn.net/qinyuanpei. 不知从什么时候開始,国产RPG单机游戏開始出现换装,仙剑系列中第一部实现了换装的 ...