I have a project created with Flash Builder 4, which uses Zend Framework to interface with a PHP script that interfaces with our MySQL database. The person that set all this up for us has left the company, so I have to try and figure this out. It looks like the Zend Framework folder is located at /var/www/ZendFramework, and in this folder there is a "library" folder and inside that is a "Zend" folder.

The amf_config.ini in the root folder of my application, which is at /var/www/html/cc/ControlCenterX.XX.XXXXXX, has these contents:

webroot = ./
zend_path = /var/www/ZendFramework/library
amf.production = false

and the gateway.php has these contents, which I assume is the default:

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';

//Load ini file and locate zend directory
if(file_exists($configfile)) {
  $webroot = $arr['zend']['webroot'];
  $zenddir = $webroot. '/ZendFramework/library';
  $zenddir = $arr['zend']['zend_path'];

// Setup include path
 //add zend directory to include path
// Initialize Zend Framework loader
require_once 'Zend/Loader/Autoloader.php';
// Load configuration
$default_config = new Zend_Config(array("production" => false), true);
$default_config->merge(new Zend_Config_Ini($configfile, 'zendamf'));
$amf = $default_config->amf;

// Store configuration in the registry
Zend_Registry::set("amf-config", $amf);
// Initialize AMF Server
$server = new Zend_Amf_Server();
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 == "./"){       
       $tempPath = $webroot . "/" . $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();

This application works fine on our local server.

We are now migrating everything to an off-site cloud server. This cloud server has multiple virtual hosts, one for each of our local servers that we are migrating. I installed the Zend Framework by doing apt-get install zend-framework. It looks like, by default, it installs to /usr/share/php/libzend-framework-php. I tried changing the zend_path in amf_config.ini to that location, but I am getting a "Channel disconnected before an acknowledgement was received" error. I tried copying the ZendFramework folder from the local server to /var/www/ControlCenter on the cloud server, which is the new document root for that virtual host, and then changing the zend_path in amf_config.ini to "/var/www/ControlCenter/ZendFramework/library", but I get the exact same result.

My Flash application is located at /var/www/ControlCenter/ControlCenterX.XX.XXXXXX, which is also the folder that contains amf_config.ini, gateway.php, and my PHP script.

It looks like the PHP function is getting called just fine. To test, I had the function create a text file. When the Flash application calls the PHP function, the text file is created, so the function is called, but it looks like there's a problem in sending the data back to the Flash application.

I am by NO means an expert at any of this kinda stuff, so please dumb your answer down as much as possible for me :-)



  • This is definately serverfault related, based on this definition: meta.webmasters.stackexchange.com/questions/365/… – Mark Henderson Dec 7 '10 at 22:30
  • Darn, this subject isn't even getting many views. Guess I should have picked a title that looks easier to solve ;-) – Travesty3 Dec 9 '10 at 15:39
  • I would add this as a comment, but I can't comment. Since the php is triggering properly, and it works fine on your local server, I wonder if it's something wrong with the flash application. I'm no expert in flash, though. Having determined php is properly being called, I would turn to the Flash to see what's going on. – DTest Dec 14 '10 at 16:20

I figured out the problem. It was actually something with the PHP file, not a configuration issue. My PHP file is structured like this:

class FLASH
    public static function testFunction($param1, $param2)
        // do stuff
        return $value;

if ($_GET["function"])
        case "testFunction":
            $result = FLASH::testFunction($_GET["param1"], $_GET["param2"]);
            echo $result;

This way, I can test the PHP function in a browser easily by calling "http://my-url.com/FLASH.php?function=testFunction&param1=value1&param2=value2". This worked with no problems at all on my local server, but for some reason, the new server didn't like the testing area in that file. It kept saying that "function" is undefined or something, talking about the if ($_GET["function"]) part. So I took the testing part out and put it in a secondary file, called it testFLASH.php, and included FLASH.php in it via require_once("FLASH.php"); and now I can test the functions by calling testFLASH.php in the browser instead of FLASH.php.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.