Channel.Security.Error ...错误#2048

时间:2011-11-02 01:14:15

标签: flex flex4.5

我最近升级到Flash Builder 4.5 for PHP,并尝试将发布版本上传到我的remoteserver。当我尝试从应用程序进行php调用时,我收到错误:

Send failednChannel.Security.Error error Error #2048 url: 'http://localhost/my_php/public/gateway.php'

发布版本在我的localhost机器上运行正常。我的所有php服务调用都在我的远程主机上。这是我的远程主机的结构:

/my_directory/html (this is the root directory)
/my_directory/html/my_php/public/release  (this is where my .html wrapper and .swf files sit)
/my_directory/html/my_php/public (this is where my gateway.php and amf_config.ini files sit)

该错误专门引用'localhost',但我无法找到设置的位置。当我发现谷歌错误#2048时,解决方案指向一个配置错误的跨域文件...我的所有服务都在remotehost(应用程序托管的地方)上,所以我认为这不是问题所在。

这是我的amf_config.ini文件:

[zend]
webroot = "/my_directory/html"

zend_path ="/my_directory/html/ZendFramework/library"
library ="/my_directory/html/my_php/library"
services ="/my_directory/html/my_php/services"

[zendamf]
amf.production = false
amf.directories[]=/my_directory/html/my_php/services

这是我的gateway.php文件:

<?php
ini_set("display_errors", 1);
$dir = dirname(__FILE__);
$webroot = $_SERVER['DOCUMENT_ROOT'];
$configfile = "$dir/amf_config.ini";
$servicesdir = $dir.'/../services';
$librarydir = $dir.'/../library';
//default zend install directory
$zenddir = $webroot.'/ZendFramework/library';
//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'];
}
if (isset($arr['zend']['library'])) {
    $librarydir = $arr['zend']['library'];
}
if (isset($arr['zend']['services'])) {
    $servicesdir = $arr['zend']['services'];
}
}
// Setup include path
// add zend directory, library and services to include path
set_include_path(get_include_path()
.PATH_SEPARATOR.$zenddir
.PATH_SEPARATOR.$librarydir
.PATH_SEPARATOR.$servicesdir);
// Initialize Zend Framework loader
require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance()->setFallbackAutoloader(true)->suppressNotFoundWarnings(true);
// 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) {
    if ($dir == "./") {
        $server->addDirectory($webroot);
    } else 
        if (realpath("{$webroot}/{$dir}")) {
            $server->addDirectory("{$webroot}/{$dir}");
        } else 
            if (realpath($dir)) {
                $server->addDirectory(realpath($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();

1 个答案:

答案 0 :(得分:0)

我在flex-blaze环境中遇到了同样的问题。真正的问题是项目属性中的上下文根。 因为您使用了flex 4.5,所以此设置没有输入字段。在flex builder 3中,项目属性中有一个设置 - &gt; flex服务器 - &gt;上下文根。

我疯了,发现了一篇关于adobes bugs-site [FB-22939]的文章。

解决了我的问题。我不知道,您正在使用的项目设置,尝试在项目中搜索名为{context.root}的字符串,或者发布更多关于项目设置的信息。我知道blaze与php有所不同,但也许这是一个让你回到正轨的提示。

不幸的是,我无法重现我的线程并设置一个PHP环境,更多地了解您的设置。 (服务器技术,等等)

编辑: 附加信息: 我找到了所有编译器参数的列表。试试这个论点:

-context-root <context-path>
    full name -compiler.context-root
    path to replace {context.root} tokens for service channel endpoints

BR 弗兰克