Gần đây tôi đã nâng cấp lên Flash Builder 4.5 cho PHP và đang cố gắng tải lên bản phát hành bản dựng lên trình điều khiển từ xa của mình. Khi tôi cố gắng thực hiện cuộc gọi php từ ứng dụng, tôi gặp lỗi:Channel.Security.Error ... Lỗi # 2048
Send failednChannel.Security.Error error Error #2048 url: 'http://localhost/my_php/public/gateway.php'
Bản phát hành xây dựng hoạt động tốt trên máy cục bộ của tôi. Tất cả các cuộc gọi dịch vụ php của tôi đều nằm trên máy chủ từ xa của tôi. Đây là cấu trúc của máy chủ từ xa của tôi:
/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ỗi cụ thể tham chiếu 'localhost', nhưng tôi không thể tìm thấy vị trí được đặt. Khi tôi google lỗi # 2048, các giải pháp trỏ đến tệp crossdomain được định cấu hình sai ... tất cả các dịch vụ của tôi đều nằm trên remotehost (nơi ứng dụng được lưu trữ) vì vậy tôi không nghĩ đó có thể là vấn đề.
Đây là tập tin amf_config.ini tôi:
[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
Dưới đây là tập tin của tôi 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();
kỳ quặc, các tài liệu tham khảo thông báo lỗi "http: //localhost/my_php/public/gateway.php" nhưng không có tài liệu tham khảo để "localhost" trong my gateway hoặc tập tin cấu hình amf –
Bạn gọi dịch vụ này như thế nào trong ứng dụng Flex? Các thuộc tính 'endpoint',' source', 'destination' của remoteObject của bạn là gì? Ngoài ra điều gì sẽ xảy ra nếu bạn mở gateway.php trong trình duyệt của mình? Theo thông báo lỗi, có vẻ như, vấn đề là, Flex gọi Localhost .. – sydd
yeah, gateway.php không trả về lỗi khi tôi cố gắng tải nó trực tiếp trên trình duyệt. Tôi không thể tìm thấy nơi 'localhost' đang được chỉ định trong php hoặc ứng dụng –