Recientemente me actualicé a Flash Builder 4.5 para PHP y estoy tratando de cargar una versión de lanzamiento a mi servidor remoto. Cuando intento hacer una llamada php desde la aplicación, me sale el error:Channel.Security.Error ... Error # 2048
Send failednChannel.Security.Error error Error #2048 url: 'http://localhost/my_php/public/gateway.php'
La versión de lanzamiento funciona bien en mi máquina localhost. Todas mis llamadas al servicio php están en mi host remoto. Aquí está la estructura de mi host remoto:
/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)
El error específicamente referencias 'localhost', pero no puedo encontrar dónde que consigue el sistema. Cuando busco el error # 2048 de Google, las soluciones apuntan a un archivo de dominio cruzado mal configurado ... todos mis servicios están en el host remoto (donde está alojada la aplicación), así que no creo que ese sea el problema.
Aquí está mi archivo 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
Aquí está mi archivo 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();
curiosamente, las referencias mensaje de error "http: //localhost/my_php/public/gateway.php", pero no se hace referencia a "localhost" en mi puerta de enlace o archivo de configuración amf –
¿Cómo llamas a este servicio en tu aplicación Flex? ¿Cuáles son las propiedades 'endpoint',' source', 'destination' de su remoteObject? ¿Qué ocurre si abre gateway.php en su navegador? De acuerdo con el mensaje de error, parece que el problema es que Flex llama a Localhost ... – sydd
Sí, gateway.php no devuelve ningún error cuando intento cargarlo directamente en el navegador. Parece que no puedo encontrar dónde se especifica 'localhost' en la aplicación php o –