2011-11-02 19 views
5

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(); 
+0

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 –

+0

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

+0

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 –

Trả lời

0

tôi đã có cùng một vấn đề trong một flex - ngọn lửa - môi trường. Vấn đề thực sự là bối cảnh gốc trong các thuộc tính của dự án. vì bạn đã sử dụng flex 4.5, không có trường nhập cho cài đặt này. trong builder flex 3, đã có một thiết lập trong thuộc tính của project -> flex server -> context root.

tôi đã phát điên và tìm thấy sau hàng giờ một bài viết về adobes bugs-site [FB-22939].

Điều đó giải quyết được sự cố của tôi. Tôi không có ý tưởng, mà các thiết lập dự án bạn đang sử dụng, cố gắng tìm kiếm một chuỗi có tên {context.root} trong dự án của bạn hoặc đăng một chút liite hơn về các thiết lập dự án của bạn. tôi biết blaze là khác với php, nhưng có lẽ nó là một mẹo mang bạn trở lại đúng hướng.

Rất tiếc, tôi không thể tạo lại chuỗi của mình và thiết lập môi trường php với nhiều kiến ​​thức hơn về thiết lập của bạn. (Máy chủ-Công nghệ, và một)

chỉnh sửa: Thông tin bổ sung: Tôi đã tìm thấy danh sách tất cả đối số trình biên dịch. Hãy thử nó với lập luận này:

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

BR Frank