title: Channel.Security.Error...Error #2048
body: <p>I recently upgraded to Flash Builder 4.5 for PHP and am trying to upload a release build to my remoteserver. When I try to make a php call from the app, I get the error: </p>
  
  <pre><code>Send failednChannel.Security.Error error Error #2048 url: 'http://localhost/my_php/public/gateway.php'
  </code></pre>
  
  <p>The release build works fine on my localhost machine. All of my php service calls are on my remote host. Here's the structure of my remote host:</p>
  
  <pre><code>/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)
  </code></pre>
  
  <p>The error specifically references 'localhost', but I can't find where that gets set. When I google error #2048, the solutions point to a badly configured crossdomain file...all my services are on remotehost (where the app is hosted) so I don't think that could be the issue.</p>
  
  <p>Here is my amf_config.ini file: </p>
  
  <pre><code>[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
  </code></pre>
  
  <p>Here is my gateway.php file:</p>
  
  <pre><code>&lt;?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()-&gt;setFallbackAutoloader(true)-&gt;suppressNotFoundWarnings(true);
  // Load configuration
  $default_config = new Zend_Config(array("production" =&gt; false), true);
  $default_config-&gt;merge(new Zend_Config_Ini($configfile, 'zendamf'));
  $default_config-&gt;setReadOnly();
  $amf = $default_config-&gt;amf;
  // Store configuration in the registry
  Zend_Registry::set("amf-config", $amf);
  // Initialize AMF Server
  $server = new Zend_Amf_Server();
  $server-&gt;setProduction($amf-&gt;production);
  if (isset($amf-&gt;directories)) {
  $dirs = $amf-&gt;directories-&gt;toArray();
  foreach ($dirs as $dir) {
      if ($dir == "./") {
          $server-&gt;addDirectory($webroot);
      } else 
          if (realpath("{$webroot}/{$dir}")) {
              $server-&gt;addDirectory("{$webroot}/{$dir}");
          } else 
              if (realpath($dir)) {
                  $server-&gt;addDirectory(realpath($dir));
              }
  }
  }
  // Initialize introspector for non-production
  if (! $amf-&gt;production) {
  $server-&gt;setClass('Zend_Amf_Adobe_Introspector', '', 
  array("config" =&gt; $default_config, "server" =&gt; $server));
  $server-&gt;setClass('Zend_Amf_Adobe_DbInspector', '', 
  array("config" =&gt; $default_config, "server" =&gt; $server));
  }
  // Handle request
  echo $server-&gt;handle();
  </code></pre>