买了本 《php web2.0开发实战》,照着第二章准备弄个”hello word” 程序。可是却在安装时却遇到了一些问题。下面就说说这些。
我是在windows环境下安装了xampp
从 http://www.myphpbook.com 里的下载页时下载zend 1.0, 当然有最新的1.9了,可以去zend官网下载。然后把第二章的源码下载下来。
将下载的 ZendFramework-1.0.2.tar.gz解压后,就去配置虚拟主机了,然后把第二章的代码复制到相应的目录下。结果一运行,出现了这样的错误:
Warning: require_once(Zend/Loader.php) [function.require-once]: failed to open stream: No such file or directory in E:webphpweb20htdocsindex.php on line 2
Fatal error: require_once() [function.require]: Failed opening required ‘Zend/Loader.php’ (include_path=’.;E:/web/phpweb20/include’) in E:webphpweb20htdocsindex.php on line 2
去网上折腾了一烦,发现是<VirtualHost>配置里的 php_value include_path “.;E:/phpweb20/include;E:/xampp/php/PEAR” 包含出了此问题,我并没有把 Zend放到E:/phpweb20/include目录下,我就把ZendFramework-1.0.2library里的Zend目录弄到E:/phpweb20/include/目录下,然后运行,那个错误没有了,可是新问题来了。
报如下错:
Fatal error: Uncaught exception ‘Zend_Log_Exception’ with message ‘”/var/www/phpweb20/data/logs/debug.log” cannot be opened with mode “a”‘ in E:webphpweb20includeZendLogWriterStream.php:66 Stack trace: #0 E:webphpweb20htdocsindex.php(11): Zend_Log_Writer_Stream->__construct(‘/var/www/phpweb…’) #1 {main} thrown in E:webphpweb20includeZendLogWriterStream.php on line 66
又去网上搜,发现是/var/www/phpweb20/data/logs/ 目录不存在的问题,原来网上下的源码里的 settings.ini的配置是针对于linux环境下的,而我这是windows 所以就把那些路径改成:
[development]
database.type = pdo_mysql
database.hostname = localhost
database.username = phpweb20
database.password = myPassword
database.database = phpweb20
database.hostname = localhost
database.username = phpweb20
database.password = myPassword
database.database = phpweb20
paths.base = E:phpweb20
paths.data = E:phpweb20data
paths.templates = E:phpweb20templates
paths.data = E:phpweb20data
paths.templates = E:phpweb20templates
logging.file = E:phpweb20datalogsdebug.log
然后再运行,就OK了,出现了 “Web site home “
终于成功了。