Skip navigation
Currently Being Moderated

Zend error when trying to transfer Flex project to web server from localhost

Sep 9, 2013 9:30 AM

Tags: #error #flex #server #zend #amf #4.7

Hi there


I am following the TestDrive tutorial for creating a Flex mobile app that connects to PHP/MySQL using Flash Builder 4.7


I have it all working perfectly locally but now I am that this section, where I need to get it working with my web server:


My server is


I am having problems getting the first stage working though. I have installed Zend at


I have uploaded the TestDrive folder at and within that, there is a folder called 'public' where my gateway.php and amf_config.ini files are.


I have edited amf_config.ini like so (followbi is my username and the web root according to cpanel is /home/followbi:


;set the absolute location path of webroot directory, example:
;Windows: C:\apache\www
;MAC/UNIX: /user/apache/www
webroot = /home/followbi/www

;set the absolute location path of zend installation directory, example:
;Windows: C:\apache\PHPFrameworks\ZendFramework\library
;MAC/UNIX: /user/apache/PHPFrameworks/ZendFramework/library
zend_path = /home/followbi/www/ZendFramework/library

amf.production = false


The gateway.php file is as it was already:


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


When I go to instead of getting "Zend Amf Endpoint" as it should display, I get an error:


Warning: require_once(Zend/Loader/Autoloader.php) [function.require-once]: failed to open stream: No such file or directory in /home/followbi/public_html/TestDrive/public/gateway.php on line 27

Fatal error: require_once() [function.require]: Failed opening required 'Zend/Loader/Autoloader.php' (include_path='.:/usr/local/lib/php:/home/followbi/www/ZendFramework/library') in/home/followbi/public_html/TestDrive/public/gateway.php on line 27


I have tried for hours playing about with the different paths, but I have very little knowledge of this aspect of things, so I don't really understand what I am doing wrong.


Any help would be massively appreciated.





More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points