Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/288.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Flex/Zend通道连接失败错误_Php_Apache Flex_Zend Framework_Zend Loader - Fatal编程技术网

Php Flex/Zend通道连接失败错误

Php Flex/Zend通道连接失败错误,php,apache-flex,zend-framework,zend-loader,Php,Apache Flex,Zend Framework,Zend Loader,我正在使用Flex和php开发我的项目。在我的本地机器上一切都很好。但是,当我将文件上传到我的服务器(godaddy.com)时。加载flex应用程序时出错 弹出的错误消息为 发送失败 channel.connect.failed.error Netconnection.call.Badversion:url: 我已经将我的ZendFramewrok文件夹上传到我的服务器,并且已经配置了amf_config.ini。(webroot=) 我不知道这里发生了什么事。请帮忙。谢谢 更新: my g

我正在使用Flex和php开发我的项目。在我的本地机器上一切都很好。但是,当我将文件上传到我的服务器(godaddy.com)时。加载flex应用程序时出错

弹出的错误消息为

发送失败 channel.connect.failed.error Netconnection.call.Badversion:url:

我已经将我的ZendFramewrok文件夹上传到我的服务器,并且已经配置了amf_config.ini。(webroot=) 我不知道这里发生了什么事。请帮忙。谢谢

更新: 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();

我打赌是
gateway.php
抛出了一个错误,并破坏了Flex应用程序所期望的结果。您可以尝试直接调用
gateway.php
吗?

这是服务捕获非常方便的地方-它将向您显示与Flex/php的来回通信,如果它崩溃,还将向您显示正常的php跟踪


您的include\u目录似乎设置不正确。您说
Autoloader.php
ZendFramework/library
中。要找到它,需要将PHP设置为在该目录中查找包含文件


您可以使用

进行设置。我也遇到了同样的问题,我通过在命令“require”或“require\u once”中更正路径解决了这个问题

它在Windows localhost上运行正常,但在上传到我的linux服务器后,由于前面的斜杠,我所有的require路径都需要更新。Linux对此有不同的理解;)

根据您对pukka的评论,您的问题可以通过将第27行更改为

require_once $zenddir. '/Zend/Loader/Autoloader.php';
希望这对像我们一样处于同样处境的人有所帮助


顺便说一句,dittonamed是对的,这些工具真的很棒,我只是使用了不同的工具(Charles或Wireshark-有点重),但是没有它们就不会有进展;)

谢谢你,佩卡。我不能直接调用gateway.php。它是通过Flex应用程序实现的。我只是把gateway.php代码放在这里。谢谢你的回复+1@Jerry你不能直接调用它,看看它是否能正常工作而没有任何明显的致命错误吗?请调用你的
gateway.php
,看看它是否会抛出任何错误。另外,你的Flex代码中调用php脚本的部分也可以发布。