
[英]Getting “require_once(Zend/Loader/Autoloader.php): failed to open stream: No such file or directory”
[英]require_once(/Zend/Loader/Autoloader.php): failed to open stream
我正在将Flex 4生产版本发布到生产服务器,并遇到“ require_once(/Zend/Loader/Autoloader.php):无法打开流”的问题。
该应用程序在Flash Builder 4.6和WAMP下运行良好。 通过FTP将发行版构建到生产服务器(运行MYSQL5,PHP5和Apache2)并执行应用程序之后,我能够看到我的应用程序的第一个屏幕,事实证明可以在生产服务器中找到这些应用程序。 但是,当应用程序要从MYSQL获取数据时,将不再响应。 我已阅读此https://forums.adobe.com/thread/1151691,并按照说明设置了amf_config.ini和gateway.php,但无法解决问题。 产品服务器目录为:httpdocs-BookClub-历史记录(文件夹)-一些文件-amf_config.ini-gateway.php-服务(flex应用程序所需的所有php服务)-ZendFramework(与FB4安装的相同)。 6)
下面是amf_config.ini
[zend];设置webroot目录的绝对位置路径,例如:Windows:C:\\ apache \\ www; MAC / UNIX:/ user / apache / www; webroot = D:/ Apps / Installations / wamp / www webroot = http://www.bbrchk.com/BookClub/
;设置zend安装目录的绝对位置路径,例如:Windows:C:\\ apache \\ PHPFrameworks \\ ZendFramework \\ library; MAC / UNIX:/ user / apache / PHPFrameworks / ZendFramework / library zend_path =。/ ZendFramework / library
[zendamf] amf.production = true amf.directories [] =。/ Services / BookClub
下面是gateway.php
//默认的zend安装目录$ zenddir = $ webroot。 '/ ZendFramework / library';
//加载ini文件并找到zend目录if(file_exists($ configfile)){$ arr = parse_ini_file($ configfile,true); if(isset($ arr ['zend'] ['webroot'])){$ webroot = $ arr ['zend'] ['webroot']; $ zenddir = $ webroot。 '/ ZendFramework / library'; } if(isset($ arr ['zend'] ['zend_path'])){$ zenddir = $ arr ['zend'] ['zend_path']; }} //设置包含路径//添加zend目录以包含路径
set_include_path(get_include_path()。PATH_SEPARATOR。$ zenddir); //初始化Zend Framework加载器
回声get_include_path(); require_once'/Zend/Loader/Autoloader.php'; Zend_Loader_Autoloader :: getInstance(); //加载配置$ default_config = new Zend_Config(array(“ production” => false),true); $ default_config->合并(new Zend_Config_Ini($ configfile,'zendamf')); $ default_config-> setReadOnly(); $ amf = $ default_config-> amf;
//将配置存储在注册表Zend_Registry :: set(“ amf-config”,$ amf);中 //初始化AMF服务器$ server = new Zend_Amf_Server();
$ server-> setProduction($ amf-> production);
if(isset($ amf-> directories)){$ dirs = $ amf-> directories-> toArray(); foreach($ dirs as $ dir){//获取路径的第一个字符。 //如果不是以斜杠开头,则表示该路径是相对于webroot的。 否则,它将被视为绝对路径$ length = strlen($ dir);。 $ firstChar = $ dir; if($ length> = 1)$ firstChar = $ dir [0];
if($firstChar != "/"){
// if the directory is ./ path then we add the webroot only.
if($dir == "./"){
$server->addDirectory($webroot);
}else{
$tempPath = $webroot . "/" . $dir;
$server->addDirectory($tempPath);
}
}else{
$server->addDirectory($dir);
}
}}
//初始化非生产型内省器if(!$ amf-> production){$ server-> setClass('Zend_Amf_Adobe_Introspector','',array(“ config” => $ default_config,“ server” => $ server)) ; $ server-> setClass('Zend_Amf_Adobe_DbInspector','',array(“ config” => $ default_config,“ server” => $ server)); } //处理请求echo $ server-> handle();
我通过执行http://mydomain/BookClub/gateway.php测试端点,并期望看到“ Zend Amf端点”。 而是抛出以下错误:
警告:require_once(/Zend/Loader/Autoloader.php):无法打开流:第29行的/var/www/vhosts/mydomain.com/httpdocs/BookClub/gateway.php中没有此类文件或目录
致命错误:require_once():无法在/ var /中打开所需的'/Zend/Loader/Autoloader.php'(include_path ='。:/ opt / plesk / php / 5.6 / share / pear:./ ZendFramework / library')第29行的www / vhosts / mydomain.com / httpdocs / BookClub / gateway.php
请告知如何解决。 很多年前,我遇到了同样的问题,但是却忘记了如何解决。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.