0

我正在尝试创建一个 helloworld GAE 项目以使用 PHP 连接到 Google Cloud SQL 数据库。我遵循以下步骤: https ://developers.google.com/appengine/docs/php/gettingstarted/helloworld

但是,每当我启动 dev_appserver.py 来测试我的 helloworld.php 时,我最终都会收到权限被拒绝错误。我在 Win8 (64) 机器上运行 Cygwin (mintty)。我已经chmod -R 777 *在许多相关目录上运行,例如:/usr/bin/

  1. c:/开发/appengine-php-sdk-1.8.0/
  2. c:/开发/php/
  3. c:/开发/PHP脚本/helloworld/

错误

File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
    self.run()

 File "/usr/lib/python2.7/threading.py", line 504, in run
    self.__target(*self.__args, **self.__kwargs)

File "/cygdrive/c/Development/appengine-php-sdk-1.8.0/google_appengine/google/appengine/tools/devappserver2/server.py", line 1232, in _loop_adjusting_instances
    self._adjust_instances()

File "/cygdrive/c/Development/appengine-php-sdk-1.8.0/google_appengine/google/appengine/tools/devappserver2/server.py", line 1209, in _adjust_instances
    self._add_instance(permit_warmup=True)


 File "/cygdrive/c/Development/appengine-php-sdk-1.8.0/google_appengine/google/appengine/tools/devappserver2/server.py", line 1087, in _add_instance
    expect_ready_request=perform_warmup)

 File "/cygdrive/c/Development/appengine-php-sdk-1.8.0/google_appengine/google/appengine/tools/devappserver2/php_runtime.py", line 195, in new_instance
    self._check_environment(php_executable_path)

 File "/cygdrive/c/Development/appengine-php-sdk-1.8.0/google_appengine/google/appengine/tools/devappserver2/php_runtime.py", line 138, in _check_environment
    env={})

File "/cygdrive/c/Development/appengine-php-sdk-1.8.0/google_appengine/google/appengine/tools/devappserver2/safe_subprocess.py", line 61, in start_process
    stdin=subprocess.PIPE)

File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
    errread, errwrite)

 File "/usr/lib/python2.7/subprocess.py", line 1248, in _execute_child
    raise child_exception

OSError: [Errno 13] Permission denied

如何确定权限问题与哪个文件有关?

编辑 这个新错误没有回溯(现在我正在调用实际的 exe): WARNING 2013-06-04 02:21:13,243 api_server.py:329] Could not initialize images API; you are likely missing the Python "PIL" module. INFO 2013-06-04 02:21:13,252 api_server.py:153] Starting API server at: http://localhost:51615 INFO 2013-06-04 02:21:13,261 dispatcher.py:164] Starting server "default" running at: http://localhost:8080 INFO 2013-06-04 02:21:13,324 admin_server.py:117] Starting admin server at: http://localhost:8000 ERROR 2013-06-04 02:21:13,553 php_runtime.py:199] The PHP runtime is not available because: No input file specified.

然后当我去localhost:8080我得到这个:`使用--php_executable_path标志(“/cygdrive/c/Development/php/php-cgi.exe”)指定的PHP解释器与App Engine PHP开发环境不兼容。

未指定输入文件。`

4

1 回答 1

2

问题出在您的命令行中:

appengine-php-sdk-1.8.0/google_appengine/dev_appserver.py --php_executable_path=/cygdrive/c/Development/php/ /cygdrive/c/Development/PhpScripts/helloworld/

php_executable_path的不是可执行文件,而是目录。因此,GAE 尝试/cygdrive/c/Development/php/像程序一样运行,并得到一个EACCES(“权限被拒绝”),完全按照它应该的方式运行。

解决方法是通过/cygdrive/c/Development/php/php.exe(或其他任何名称)。


我相信您的新问题正是我在早期评论中以及在此答案的早期版本中提到的:您正在以不起作用的方式混合 cygwin 和本机代码。

特别是,您似乎在 cygwin Python 解释器中运行原生 Windows 版本的 GAE,然后将其指向原生 Windowsphp-cgi解释器。很难准确猜出这些多重不匹配中的哪一个是罪魁祸首,但很可能是其中之一。所以,要么:

  • 使用本机 Windows Python,或
  • 使用 cygwin/POSIX GAE 和 cygwin PHP 解释器。
于 2013-06-04T02:24:37.567 回答