使用WAMP构建一个ZendFrameWork项目修正篇

来源:互联网 发布:服务器监控软件 排行 编辑:程序博客网 时间:2024/04/29 12:54

    上一篇使用ZendStudio构建一个ZendFramework项目,按照视频中的讲解,最后以失败告终,想想也是,我使用的是WAMP傻瓜版,按照别人全手动的来配置来搭建WAMP的修改来该傻瓜版的修改,失败也就不足为奇了,今天继续研究,发现这个帖子靠谱:

转自bbs.dedecms.com/simple/?t123351.html

 

WINDOWS XP 下Zend Studio For Eclipse 和 Zend Framework  配置

本例中以假设你正确安装了ZEND STUDIO FOR ECLIPSE
1,安装WampServer
下载WAMPSERVER并安装,在本例中,安装在D:\wamp下。
2 安装Zend Framework
解压缩 Zend Framework 压缩包中 \library\ 至 D:\wamp\library ,记住,路径别搞错了。
3 开启支持rewrite module
编辑 httpd.conf。
- 编辑 D:\wamp\bin\apache\Apache2.2.10\conf\httpd.conf 文件。或
- 右击托盘里WampServer小图标 --> Apache --> httpd.conf
# LoadModule rewrite_module modules/mod_rewrite.so
去掉 '#',改为:
LoadModule rewrite_module modules/mod_rewrite.so
4 PHP library 设置
- 编辑 D:\wamp\bin\php\php5.2.7\php.ini,或
- 右击托盘里WampServer小图标 --> PHP --> php.ini
; Windows: "\path1;\path2"
; include_path = ".;c:\php\includes"
去掉 ';',并且加上Zend Framework 压缩包安装路径,改为:
; Windows: "\path1;\path2"
include_path = ".;c:\php\includes;d:\wamp\library;"

5 启动Zend Studio For Eclipse 并且新建项目
启动 Zend Studio for Eclipse
File --> New --> Zend Framework Project -> Project Name: test -> Finish
6 在Apache中加入新项目
单击托盘里WampServer小图标 --> Apache --> ALIAS目录 --> 添加一个ALIAS
输入url: test
输入项目地址:http:\localhost\test
(注,貌似这步可有可无,因为我后来我另建一个项目,并没有执行该步,仍然可以显示结果)

7 在浏览器输入http://localhost/test/ 或者http://localhost/test/html/index.php
前者的结果是输出三个目录application/,html/,library/
而后者如果在第四步出现错误的话,会出现以下错误:
Warning: require_once(Zend/Controller/Front.php) [function.require-once]: failed to
open stream: No such file or directory in ......
Fatal error: require_once() [function.require]: Failed opening required
'Zend/Controller/Front.php' (include_path='.;C:\php5\pear') in ......

写到这里,不得不长啸一声,当初我也是弄了很久,但是环境配置还是死活弄不出来,当时在GOOGLE
上找了很久终于找到了篇文章,我也是按照他的PHP library 设置来配置的,原文如下:

右击托盘里WampServer小图标 --> PHP --> php.ini
;include_path = ".;D:\Program Files\wamp\library"
去掉 ';',改为:
include_path = ".;D:\Program Files\wamp\library"

当初我就卡死在这个配置上了,因为在该配置中有两个“;include_path”,而该文章也没写清楚是

哪个~
后来又GOOGLE了很久,终于发现原来是改“Windows: ”底下那个路径~
还没完,那到底是怎么改的呢?我又GOOGLE了很久,终于找到了一篇文章;原文如下:


下载 ZF1.5后 ,我将 ZF下的library 文件改名成ZF放到 G:\AppServ\ZF下,并配置php.ini文件的
include_path为
; Windows: "\path1;\path2"
;include_path = ".;c:\php\includes;G:\AppServ\ZF;"

看到这里我终于顿悟,原来是加上Zend Framework 压缩包安装路径就可以了,于是修改如下:
include_path = ".;c:\php\includes;D:\wamp\library;"

满心欢喜,输入地址,结果还是出现了:
Warning: require_once(Zend/Controller/Front.php) [function.require-once]: failed to
open stream: No such file or directory in ......
Fatal error: require_once() [function.require]: Failed opening required
'Zend/Controller/Front.php' (include_path='.;C:\php5\pear') in ......

百思不得其解,就在我快要崩溃的时候(我已经整整弄了两个小时了),我突然发现,路径盘符默认的
是小写:include_path = ".;c:\php\includes; 那是不是我自己加的盘符也是小写的呢?抱着死马当活
马医的态度,路径改为:
include_path = ".;c:\php\includes;d:\wamp\library;"
在浏览器输入“http://localhost/test/html/index.php”,回车......
"Hello,world!"
我当时差点哭了出来......

本人正在自学PHP,一切的一切都是通过GOOGLE(或baidu)+摸索而来的, 写下这篇文章只是为了纪
念我的又一次痛苦的配置经历(上次是ECLPSEPHP的浏览器问题),如果这篇文章能对你有一丁点的帮助
,本人很是高兴,若没有的话,就当是茶余饭后的一点笑料咯,并且感谢您的收看~
当然,我只是仅仅把路径配置好了,至于框架怎么用,估计又是一次漫长的旅程了......

原创粉丝点击