我正在遵循谷歌应用引擎“使用用户服务”的分步指南,但是在我在本地运行应用服务器之后
C:\Users\xxx>dev_appserver.py --php_exectuable_path="C:\Users\xxx\Desktop\php54\php-cgi.exe" C:\Users\xxx\Desktop\FirstPhpPrj\
弹出以下错误:
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed:
No such host is known. in <b>C:\Users\xxx\Desktop\google_appengine\php\sdk\
google\appengine\runtime\RemoteApiProxy.php</b> on line 92
Warning:
file_get_contents(http://localhost:51089)
: failed to open stream:
php_network_getaddresses: getaddrinfo failed: No such host is known. in C
:\Users\xxx\Desktop\google_appengine\php\sdk\google\appengine\runtime\RemoteApiP
roxy.php on line 92
Fatal error: Uncaught exception 'google\net\ProtocolBufferDecodeError'
with message 'Not initialized: login_url' in C:\Users\xxx\Desktop\google_appengin
e\php\sdk\google\appengine\runtime\proto\ProtocolMessage.php:121
Stack trace:
#0 C:\Users\xxx\Desktop\google_appengine\php\sdk\google\appengine\runtime\proto\
ProtocolMessage.php(88): google\net\ProtocolMessage->mergeFromString('')
#1 C:\Users\xxx\Desktop\google_appengine\php\sdk\google\appengine\runtime\Remote
ApiProxy.php(109): google\net\ProtocolMessage->parseFromString('')
#2 C:\Users\xxx\Desktop\google_appengine\php\sdk\google\appengine\runtime\ApiProxy.php(42): google\appengine\runtime\RemoteApiProxy->makeSyncCall('user', 'CreateLoginURL', Object(google\appengine\CreateLoginURLRequest), Object(google\app
engine\CreateLoginURLResponse), NULL)
#3 C:\Users\xxx\Desktop\google_appengine\php\sdk\google\appengine\api
\users\UserService.php(69): google\appengine\runtime\ApiProxy::makeSyncCall('user', 'CreateLoginURL', Object(google\appengine\CreateLoginURLRequest), Object(google in C
:\Users\xxx\Desktop\google_appengine\php\sdk\google\appengine\runtime\proto\ProtocolMessage.php on line 121
我浏览了日志,有两个警告和一个致命错误。但是在我查看了 php sdk 的编码之后,我意识到这个致命错误是由“mergeFromString”中的空字符串输入引起的,实际上是由“警告”引起的
file_get_contents(http://localhost:51089)
没有这样的主机是已知的”,因为在 RemoteApiProxy.php 中,函数 CreateLoginURLResponse:
$serialized_remote_respone = file_get_contents(
'http://localhost:' . $this->apiPort, false, $context);
一旦 serialized_remote_response 得到一个空结果,它将影响下一行的命令:
$remote_response->parseFromString($serialized_remote_respone);
在这种情况下,我自己的代码实际上是无关紧要的,因为它与谷歌示例代码完全相同:here。
我只是想弄清楚为什么在谷歌应用引擎启动其 API 服务器之后
http://localhost:51089
但它不被识别!我试过固定这个主机,windows也抛出了错误!