Sponsored Link
事象
Flex Builder 4でPHPとのデータコネクション設定を行う際に上図のエラーが発生。
使用したサンプルチュートリアル:
connect to data – Flex Test Drive | Adobe Developer Connection
エラーメッセージ
Zend Framework が正しくインストールされていて、プロジェクトの出力フォルダーにある amf_config.ini ファイルでパラメーター "amf.production" が true に設定されていないことを確認してください。 Warning: Error parsing C:\Program Files (x86)\VertrigoServ\www\TestDrive\TestDrive-debug/amf_config.ini on line 5 in C:\Program Files (x86)\VertrigoServ\www\TestDrive\TestDrive-debug\gateway.php on line 12 Warning: require_once(Zend/Loader/Autoloader.php) [function.require-once]: failed to open stream: No such file or directory in C:\Program Files (x86)\VertrigoServ\www\TestDrive\TestDrive-debug\gateway.php on line 27 Fatal error: require_once() [function.require]: Failed opening required 'Zend/Loader/Autoloader.php' (include_path='.;C:\Program Files (x86)\VertrigoServ\Smarty;C:/Program Files/ZendFramework/library') in C:\Program Files (x86)\VertrigoServ\www\TestDrive\TestDrive-debug\gateway.php on line 27
amf_config.ini
[zend] ;set the absolute location path of webroot directory, example: ;Windows: C:\apache\www ;MAC/UNIX: /user/apache/www webroot =C:/Program Files (x86)/VertrigoServ/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 = [zendamf] amf.production = false amf.directories[]=TestDrive/services
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';
//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';
include_pathの’.;C:\Program Files (x86)\VertrigoServ\Smarty;C:/Program Files/ZendFramework/library’から、’Zend/Loader/Autoloader.php’を開けませんというエラー。
include_path 先のフォルダ構成を確認すると確かに’Zend/Loader/Autoloader.php’がないのでエラーが発生するのは分かる。
解決法
amf_config.iniファイル中のwebrootパラメータをコメントアウトすると正常に設定が完了。
変更前
webroot =C:/Program Files (x86)/VertrigoServ/www
変更後
;webroot =C:/Program Files (x86)/VertrigoServ/www
原因
本来はC:/Program Files (x86)/VertrigoServ/www/ZendFramework/library/Zend/Loader/Autoloader.phpを参照をすべき所を、C:/Program Files/ZendFramework/library/Zend/Loader/Autoloader.phpを参照しようとしてエラーとなった。
webroot =C:/Program Files (x86)/VertrigoServ/wwwのはずが、どこで書き換わったのかな?
今回はサンプルを走らせるのを優先したので、原因究明はここで止めています><;
追記 – 2010/07/26
以下のようなエラーメッセージが出力された場合も、上記の原因と同一である場合があります。
Send failed Channel.Connect.Failed error NetConnection.Call.BadVersion: : url: 'http://localhost/TestDrive_add_charts_PHP/gateway.php'
ご参考まで。
関連すると思われる記事:
- ActionScript: 画像ファイルをダウンロードして表示 – Loaderクラス
- AIR: テキストファイルを非同期に読み込む – openAsync()、readMultiByte()
- Flex: State、Transitionによる画面遷移 – ログイン画面
- AIR: テキストファイルに書き込み – openAsync()、writeMultiByte()
- AS3でお絵かきFlashを作る (4)塗りつぶしと簡易レイヤーの操作
Sponsored Link


