解决ZF2_PATH environment
本方法基于: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的更多相关文章
- zendframework 2
我想我的生活需要新的挑战 zf2整个框架里面都应用了namespace,并且他的每个模块,我们都可以根据自己的需要去命名路径,对我来说,zf2的模块化更加的清晰,对于外包来说,或许很方便. 创建他,我 ...
- oracle学习笔记(四)oracle内存优化
emca -config dbcontrol db -repos recreate 解决'oracle Environment variable ORACLE_SID not defined. Ple ...
- ZendFramework2 源码分析 init_autoloader.php
// Composer autoloading if (file_exists('vendor/autoload.php')) { // 加载自动加载器 $loader = include 'vend ...
- ZendFramework 环境部署
查看源码 int_autoloader.php 文件中,发现应用了一个 AutoloaderFactory 的命名空间,路径写得是相对路径,所以需要在 php.ini 中定义一个 inclde_pat ...
- sonar + jacoco + mockMvc 模拟session 用户登录 配合SpringSecurity 权限 快速测试代码覆盖率.
遇到mock 测试简直就是神器,特别是要做代码覆盖率,直接测试controller就好了,缺点,虽然可以回滚事务,但是依赖数据库数据,解决,根据SpringBoot ,再建立一个专门跑单元测试的数据库 ...
- celery和supervisor配合使用,实现supervisor管理celery进程
在这里我选择redis作为celery异步任务的中间人,系统选择CentOS6.5 64位.redis.celery和supervisor的安装参见官方文档. 安装完毕后: 1, 创建celery的实 ...
- celery Django 简单示例
一.目录结构 二.创建worker文件夹 __init__.py # -*- coding:utf-8 -*-import osfrom celery import Celery, platforms ...
- Oracle客户端工具出现“Cannot access NLS data files or invalid environment specified”错误的解决办法
Oracle客户端工具出现"Cannot access NLS data files or invalid environment specified"错误的解决办法 方法一:参考 ...
- 教新手一步步解决: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 ...
随机推荐
- Redux管理你的React应用
使用Redux管理你的React应用 因为redux和react的版本更新的比较频繁,博客园这里用的redux版本是1.0.1,如果你关心最新版本的使用技巧,欢迎来我的Github查看(https ...
- ASP.NET MVC应用程序展示RDLC报表
原文:ASP.NET MVC应用程序展示RDLC报表 学习ASP.NET MVC这样久,在学习,练习与应用过程中,觉得很多知识与以前的ASP.NET多有区别,但是实现操作起来,细处又有许多相近的地方. ...
- Spring MVC异常处理详解(转)
下图中,我画出了Spring MVC中,跟异常处理相关的主要类和接口. 在Spring MVC中,所有用于处理在请求映射和请求处理过程中抛出的异常的类,都要实现HandlerExceptionReso ...
- android_线
说明:android螺纹. android无非就是一个线程Main Thread和Worker Thread.(除了主线程Main Thread是Worker Thread) Main Thread ...
- ASP.NET MVC — 第 4 天
ASP.NET MVC — 第 4 天 目录 第 1 天 第 2 天 第 3 天 第 4 天 第 5 天 第 6 天 第 7 天 0. 前言 欢迎来到第四天的 MVC 系列学习中.如果你直接开始学习今 ...
- Android 滑动界面实现---Scroller类别 从源代码和开发文档了解(让你的移动布局)
在android学习,行动互动是软件的重要组成部分,其中Scroller是提供了拖动效果的类,在网上.比方说一些Launcher实现滑屏都能够通过这个类去实现.. 样例相关博文:Android 仿 窗 ...
- Cannot update paths and switch to branch at the same time(转)
当使用git进行操作: git checkout -b local-name origin/remote-name 出现错误: fatal: git checkout: updating paths ...
- OS X升级到10.10使用后pod故障解决方案出现
最新的mac 10.10强大的好奇心,所以,你的系统升级到10.10.结果表明,使用pod出现下述问题: /System/Library/Frameworks/Ruby.framework/Versi ...
- Mybatis 构造resultMap 搜sql
映射配置文件 <!-- type:映射数据类型的实体类 id:resultMap的唯一标识 --> <resultMap type="person" id=&qu ...
- suggest的使用方法
suggest的使用方法注意: 1. 要表示汉语的"建议做某事",英语通经常使用suggest doing sth,而不能用 suggest to do sth: 2. " ...