【ZF2】ZendFramework-2.1.4 安装实例(win7)
2014-11-13 10:29
127 查看
本方法基于: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\)。
1. 下载ZendFramework-2.1.4,提取其中的zend目录。
2. 在php.ini中添加 include_path = “.;c:\你的目录\Zend”。
(此处 建立虚拟目录啊、改HOSTS文件什么的都不详解了)
3. 此时可以去https://github.com/zendframework/ZendSkeletonApplication下载使用了,但是直接访问的时候的时间提示
4. 我们直接采用设置ZF2_PATH环境的方法。找到http.conf 文件 添加SetEnv ZF2_PATH “C:/<你的ZF2框架目录>”(注意这里不需要添加路径zend)。
1. 直接去https://github.com/zendframework/ZendSkeletonApplication下载运行。
2. 这时候我们选择php composer.phar install 的方式来安装,用CMD进入到composer.phar所在目录执行 php composer.phar install ,这时候可能会出现两种错误
一种是:
很显然是没有找到PHP环境,这时候自己去配置好环境就行(怎么配置PHP环境变量?打开“我的电脑”->“属性”->“高级”->“环境变量”->“系统变量”->“path”,编辑其值,添加你的PHP所有路径就行了),要是觉得麻烦我试了下把整个PHP的运行文件复制到目录下也能行(当然不推荐这样,太乱了)。
另一种是:
此时只需要开启php.ini中的extension=php_openssl.dll就行了
3 .要是出现
就说明已经安装成功了,此中方法不需要添加php include_path ,也不需要向添加ZF2_PATH环境。
至此PHP的安装算是基本上完成了
下面讲进行一些相关的配置:
1. 配置apache
1.1开启URL重写功能
1.2 配置虚拟目录
1.3 将域名zf2.localhost指向本机,在hosts文件(路径:c:\windows\system32\drivers\etc\hosts)中添加
此时通过域名zf2.localhost就可以直接访问到你的项目了。
操作之前您需要搭建好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\)。
方式二. 官方推荐安装方式
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)。
方式三. 在线安装
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就可以直接访问到你的项目了。
相关文章推荐
- ZendFramework-2.1.4 安装实例(win7)
- 采用zf.bat方式安装ZendFramework及创建项目详细步骤
- win7 64 下直接装sqlserver 2005 实例无法安装
- ZendFramework的介绍、安装和实例运行
- Cocos2d-x学习笔记(二)之 在Win7环境下VS2010中安装最新的cocos2d-x-2.1.4
- PLSQL连不上Win7 64位系统下安装的Oracle11g64位服务实例的解决办法
- PHP框架学习2——ZendFramework的介绍、安装和实例运行
- win7上安装memcached及客户端调用实例
- ZendFramework的介绍、安装和实例运行
- 【zendframework】ZendFramework的介绍、安装和实例运行
- 安装vs2005团队开发版和sql 2005企业版_数据库实例共存的方法
- 10g rac双实例+asm实例512内存安装备忘
- windows 2000 advanced server集群安装实例
- SQLServer2000安装程序提示“有一个挂起的安装实例,请重起机器”的解决方法
- 尝试的基于 Windows Server 2003 计算机上运行 SQL Server 2005 实例上安装 UDDI 服务数据库组件时可能收到错误信息
- 不用QQ也能聊天,企业即时通讯安装实例
- SQLServer2000安装程序提示“有一个挂起的安装实例,请重起机器”的解决方法
- 应用实例:Thinkpad上安装Ubuntu笔记
- PHP4在WinXP下IIS和Apache2服务器上的安装实例
- IIS6.0+PHP5.x+MySQL5.x+Zend3.0x+GD+phpMyAdmin2.8x通用安装实例(已经完成)