views:

30

answers:

3

Hi guys. I am using Flex and php to develop my project. Everything works great in my local machine. However, when I upload my files to my server (godaddy.com). I got the error when loading my flex application.

The pop-up error message is

send failed channel.connect.failed.error Netconnection.call.Badversion: url: http://mydomail/folder/gateway.php

I have upload my ZendFramewrok folder into my server and amf_config.ini has been configured. (webroot =http://mydomain) I am not sure what's going on here. Please help. Thanks.

Update: my gateway.php

<?php
ini_set("display_errors", 1);
$dir = dirname(__FILE__);
$webroot = $_SERVER['DOCUMENT_ROOT'];
$configfile = "$dir/amf_config.ini";

//default zend install directory
$zenddir = $webroot. '/ZendFramework/library'; //I did upload the ZendFramwork folder

//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'];
 }
}


// Setup include path
 //add zend directory to include path
set_include_path(get_include_path().PATH_SEPARATOR.$zenddir);
// Initialize Zend Framework loader
require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance();
// 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) {
     // get the first character of the path. 
     // If it does not start with slash then it implies that the path is relative to webroot. Else it will be treated as absolute path
     $length = strlen($dir);
     $firstChar = $dir;
     if($length >= 1)
      $firstChar = $dir[0];

     if($firstChar != "/"){
      // if the directory is ./ path then we add the webroot only.
      if($dir == "./"){       
       $server->addDirectory($webroot);
      }else{
       $tempPath = $webroot . "/" . $dir;
    $server->addDirectory($tempPath);
   }     
  }else{
      $server->addDirectory($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();

error from gateway.php if I call it directly.

Warning: require_once(Zend/Loader/Autoloader.php) [function.require-once]: failed to open stream: No such file or directory in /home/content/79/4687979/html/parkerList/gateway.php on line 27

Fatal error: require_once() [function.require]: Failed opening required 'Zend/Loader/Autoloader.php' (include_path='.:/usr/local/php5/lib/php:http://blackwheels.info//ZendFramework/library') in /home/content/79/4687979/html/parkerList/gateway.php on line 27

Pekka. you are right. gateway.php is the rat. but I still can't figure out what's wrong. Zend/Loader/Autoloader.php is under the server root "ZendFramework/library" folder. I don't understand why my application can't find it. Thanks again!

+1  A: 

My bet is that it's gateway.php that is throwing an error, and garbling the result your Flex app expects. Can you try calling gateway.php directly?

Pekka
thank you Pekka. I can't call gateway.php directly. Its through Flex application. I just posy my gateway.php code here. Thanks for the reply. +1
Jerry
@Jerry can't you call it directly just to see whether it works without any obvious fatal errors and such?
Pekka