Flex/Zend 通道连接失败错误
我正在使用 Flex 和 php 来开发我的项目。在我的本地机器上一切都运行良好。但是,当我将文件上传到我的服务器(godaddy.com)时。我在加载 Flex 应用程序时遇到错误。
弹出错误提示
发送失败 通道连接失败错误 Netconnection.call.Badversion:网址: http://mydomail/folder/gateway.php
我已将 ZendFramewrok 文件夹上传到我的服务器和 amf_config .ini 已配置。 (webroot =http://mydomain) 我不确定这里发生了什么事。请帮忙。谢谢。
更新: 。
<?php
ini_set("display_errors", 1);
$dir = dirname(__FILE__);
$webroot = $_SERVER['DOCUMENT_ROOT'];
$configfile = "$dir/amf_config.ini";
//default zend install directory
$zenddir = $webroot. '/ZendFramework/library'; //I did upload the ZendFramwork folder
//Load ini file and locate zend directory
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'];
}
}
// Setup include path
//add zend directory to include path
set_include_path(get_include_path().PATH_SEPARATOR.$zenddir);
// Initialize Zend Framework loader
require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance();
// Load configuration
$default_config = new Zend_Config(array("production" => false), true);
$default_config->merge(new Zend_Config_Ini($configfile, 'zendamf'));
$default_config->setReadOnly();
$amf = $default_config->amf;
// Store configuration in the registry
Zend_Registry::set("amf-config", $amf);
// Initialize AMF Server
$server = new Zend_Amf_Server();
$server->setProduction($amf->production);
if(isset($amf->directories)) {
$dirs = $amf->directories->toArray();
foreach($dirs as $dir) {
// get the first character of the path.
// If it does not start with slash then it implies that the path is relative to webroot. Else it will be treated as absolute path
$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);
}
}
}
// Initialize introspector for non-production
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));
}
// Handle request
echo $server->handle();
如果我直接调用 gateway.php,则会出现 gateway.php 错误
警告:require_once(Zend/Loader/Autoloader.php) [function.require-once]:无法打开流:没有这样的文件或目录 /home/content/79/4687979/html/parkerList/gateway.php 第 27 行
致命错误:require_once() [function.require]:无法打开所需 'Zend/Loader/Autoloader.php' (include_path='.:/usr/local/php5/lib/php:http://blackwheels.info/ /ZendFramework/库') 中
在 /home/content/79/4687979/html/parkerList/gateway.php 第 27 行Pekka 。你是对的。 gateway.php 是老鼠。但我还是不明白出了什么问题。 Zend/Loader/Autoloader.php 位于服务器根“ZendFramework/library”文件夹下。我不明白为什么我的应用程序找不到它。再次感谢!
I am using Flex and php to develop my project. Everything works great in my local machine. However, when I upload my files to my server (godaddy.com). I got the error when loading my flex application.
The pop-up error message is
send failed
channel.connect.failed.error
Netconnection.call.Badversion: url:
http://mydomail/folder/gateway.php
I have upload my ZendFramewrok folder into my server and amf_config.ini has been configured. (webroot =http://mydomain)
I am not sure what's going on here. Please help. Thanks.
Update:
my gateway.php
<?php
ini_set("display_errors", 1);
$dir = dirname(__FILE__);
$webroot = $_SERVER['DOCUMENT_ROOT'];
$configfile = "$dir/amf_config.ini";
//default zend install directory
$zenddir = $webroot. '/ZendFramework/library'; //I did upload the ZendFramwork folder
//Load ini file and locate zend directory
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'];
}
}
// Setup include path
//add zend directory to include path
set_include_path(get_include_path().PATH_SEPARATOR.$zenddir);
// Initialize Zend Framework loader
require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance();
// Load configuration
$default_config = new Zend_Config(array("production" => false), true);
$default_config->merge(new Zend_Config_Ini($configfile, 'zendamf'));
$default_config->setReadOnly();
$amf = $default_config->amf;
// Store configuration in the registry
Zend_Registry::set("amf-config", $amf);
// Initialize AMF Server
$server = new Zend_Amf_Server();
$server->setProduction($amf->production);
if(isset($amf->directories)) {
$dirs = $amf->directories->toArray();
foreach($dirs as $dir) {
// get the first character of the path.
// If it does not start with slash then it implies that the path is relative to webroot. Else it will be treated as absolute path
$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);
}
}
}
// Initialize introspector for non-production
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));
}
// Handle request
echo $server->handle();
error from gateway.php if I call it directly.
Warning: require_once(Zend/Loader/Autoloader.php)
[function.require-once]: failed to open stream: No such file or directory in
/home/content/79/4687979/html/parkerList/gateway.php on line 27
Fatal error: require_once() [function.require]: Failed opening required
'Zend/Loader/Autoloader.php'
(include_path='.:/usr/local/php5/lib/php:http://blackwheels.info//ZendFramework/library')
in /home/content/79/4687979/html/parkerList/gateway.php on line 27
Pekka. you are right. gateway.php is the rat. but I still can't figure out what's wrong.
Zend/Loader/Autoloader.php is under the server root "ZendFramework/library" folder. I don't understand why my application can't find it. Thanks again!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我遇到了同样的问题,我通过更正命令“require”或“require_once”中的路径解决了它。
在 Windows 本地主机上运行正常,但在上传到我的 Linux 服务器后,由于前导斜杠,我的所有需求路径都需要更新。 Linux 对它的理解不同;)
根据您对 pukka 的评论,您的问题可以通过将第 27 行更改为来解决,
希望这对与我们情况相同的人有所帮助。
顺便说一句,同名是对的,这些工具真的很棒,我只是使用不同的工具(Charles 或 Wireshark - 这有点重),但没有它们就不会有任何进展;)
I had the same problem and I solved it by correcting paths in command 'require' or 'require_once'.
It was running ok when on Windows localhost, but after uploading to my linux server, all my require paths needed update, because of leading slashes. Linux understands it differently ;)
Based on your comment to pukka, your problem would be solved by changing line 27 to
Hope this helps to someone in the same situation like we were.
BTW dittonamed is right, these tools are realy great, I just use different (Charles or Wireshark - which is a bit heavy) but there would be no progress without them ;)
我敢打赌,是
gateway.php
抛出了错误,并且混淆了 Flex 应用程序期望的结果。您可以尝试直接调用gateway.php
吗?My bet is that it's
gateway.php
that is throwing an error, and garbling the result your Flex app expects. Can you try callinggateway.php
directly?看来您的 include_dir 设置不正确。您说
Autoloader.php
位于ZendFramework/library
中。为了找到它,您需要将 PHP 设置为在该目录中查找包含文件。您可以使用 set_include_path 进行设置
It looks like your include_dir is set incorrectly. You say that
Autoloader.php
is inZendFramework/library
. For that to be found, you need to set PHP to look in that directory for include files.You can set this with set_include_path
这就是服务捕获很方便的地方 - 它会向您显示与 Flex/PHP 的来回通信,如果崩溃 - 还会向您显示正常的 PHP 跟踪
http://www.kevinlangdon.com/serviceCapture/
This is where Service Capture is handy - it will show you the back and forth communication with Flex/PHP and if its crashing - will also show you the normal PHP trace
http://www.kevinlangdon.com/serviceCapture/