Recentemente ho aggiornato a Flash Builder 4.5 per PHP e sto provando a caricare una versione di rilascio sul mio remoteserver. Quando provo a fare una chiamata php dalla app, ottengo l'errore:Channel.Security.Error ... Errore # 2048
Send failednChannel.Security.Error error Error #2048 url: 'http://localhost/my_php/public/gateway.php'
La build di rilascio funziona bene sulla mia macchina localhost. Tutte le mie chiamate di servizio php sono sul mio host remoto. Ecco la struttura del mio 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)
L'errore specifico riferimento 'localhost', ma non riesco a trovare dove che viene impostata. Quando provo l'errore # 2048 su google, le soluzioni rimandano a un file crossdominio configurato male ... tutti i miei servizi sono su remotehost (dove è ospitata l'app), quindi non penso che questo potrebbe essere il problema.
Ecco il mio file 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
Ecco il mio file 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();
stranamente, i riferimenti messaggio di errore "http: //localhost/my_php/public/gateway.php", ma non v'è alcun riferimento a "localhost" nel il mio file di configurazione gateway o amf –
Come si chiama questo servizio nell'app Flex? Quali sono le proprietà 'endpoint',' source', 'destination' di remoteObject? Inoltre cosa succede se apri gateway.php nel tuo browser? Secondo il messaggio di errore, sembra che il problema sia che Flex chiama Localhost .. – sydd
sì, gateway.php non restituisce errori quando provo a caricarlo direttamente nel browser. Non riesco a trovare dove viene specificato 'localhost' nel php o nell'app –