https://github.com/drslump/Protobuf-PHPで見つけたProtobuf-PHPリポジトリ:https://github.com/drslump/Protobuf-PHP.gitのクローンを作成し、インストールと構成に取り組んでいます。 protoc-gen-phpを取得してprotoファイルをPHPクラスに変換しようとすると約12時間問題が発生します。
私はPHPバージョン5.3.2を実行していますが、これが私が行ったことです。
- インストールされたPEARv1.9.4
- Console_CommandLineをインストールし、PEAR_ENV.regを実行してPEAR環境変数を設定しました。
- このプラグインでPHPクラスファイルを生成するために考えられるすべての順列を試しましたが、すべての試みが失敗しました。
ルートフォルダーにC#プロジェクトで使用しているprotoファイルがあり、proto-gen-phpプロジェクトをチェックアウトしました(以下を参照)。
message AuditLogEntry {
required int64 ID = 1;
required int64 Date = 2;
required string Message = 3;
optional int32 User_ID = 4;
optional string User_Username = 5;
optional int32 ImpUser_ID = 6;
optional string ImpUser_Username = 7;
optional string RemoteIP = 8;
}
message AuditLogQuery {
optional int64 DateRangeStart = 1;
optional int64 DateRangeEnd = 2;
optional string Search = 3;
optional int32 UserID = 4;
optional int32 Limit = 5;
optional int32 Offset = 6;
}
message AuditLogResult {
repeated AuditLogEntry LogEntries = 1;
optional int32 TotalResults = 2;
}
これが私が抱えているいくつかの問題です:
最も基本的な実装を実行しようとすると、次のようになります。
protoc-gen-php.bat AuditLog.proto
このエラーが発生します:
入力ファイルを開けませんでした:@ bin_dir @ \ protoc-gen-phpファイル名、ディレクトリ名、またはボリュームラベルの構文が正しくありません。
このエラーに関する情報をオンラインで見つけることができません。使用しているパッケージの1つをインストールする際に構成上の問題がありますか?何か案は?
上記のエラーのため、protoc-gen-phpバッチファイルの次の行を変更しました。
"%PHPBIN%" -d display_errors=stderr -d log_errors=On -d error_log=Off "@bin_dir@\protoc-gen-php" %*
に
"%PHPBIN%" -d display_errors=stderr -d log_errors=On -d error_log=Off "protoc-gen-php.php" %*
問題1で与えられたのと同じコマンドを実行すると、次の出力が得られます。
The filename, directory name, or volume label syntax is incorrect.
Protobuf-PHP @package_version@ by Ivan -DrSlump- Montes
C:\Development\SkedFlex\php-proto-buffers\AuditLog.proto: File does not reside within any path specified using --proto_path (or -I). You must specify a --proto_path which encompasses this file. Note that the proto_path must be an exact prefix of the .proto file names -- protoc is too dumb to figure out when two paths (e.g. absolute and relative) are equivalent (it's harder than you think).
ERROR: protoc exited with an error (1) when executed with:
protoc \
--plugin=protoc-gen-php="C:\Development\SkedFlex\php-proto-buffers\protoc-gen-php.php.bat" \
--proto_path="C:\Development\SkedFlex\php-proto-buffers\library\DrSlump\Protobuf\Compiler\protos" \
--php_out=":./" \
"C:\Development\SkedFlex\php-proto-buffers\AuditLog.proto"
マニュアルで指定されているように、-i、-oを使用してコマンドの多くのバリエーションを試しました:http://drslump.github.com/Protobuf-PHP/protoc-gen-php.1.html、しかし前進することができないようですこれ...
最後に、protocを直接実行しようと試みました。
protoc --plugin=protoc-gen-php --php_out=./build AuditLog.proto
これはエラーです:
--php_out: protoc-gen-php: The system cannot find the file specified.
私は立ち往生しているところです。私が抱えている問題を解決するのに役立つprotoc-gen-phpの経験がある人はいますか?