dev_appserver.py没有输入文件错误

时间:2013-06-04 01:08:16

标签: php python google-app-engine cygwin

我正在尝试创建一个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 /斌/

  1. c:/Development/appengine-php-sdk-1.8.0/
  2. C:/开发/ PHP /
  3. c:/ Development / Php Scripts / helloworld /
  4. 错误

    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开发环境不兼容。

    未指定输入文件。

1 个答案:

答案 0 :(得分: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,然后将其指向本机Windows php-cgi解释器。很难准确地猜出这些多重不匹配中的哪一个应该受到责备,但很可能其中一个是错误的。所以,要么:

  • 使用原生Windows Python或
  • 使用cygwin / POSIX GAE和cygwin PHP解释器。