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

use*_*084 5 apache-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'
Run Code Online (Sandbox Code Playgroud)

发布版本在我的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)
Run Code Online (Sandbox Code Playgroud)

该错误专门引用'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
Run Code Online (Sandbox Code Playgroud)

这是我的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();
Run Code Online (Sandbox Code Playgroud)

Fra*_*ank 0

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

我发疯了,几个小时后发现了一篇关于 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
Run Code Online (Sandbox Code Playgroud)

弗兰克