简体   繁体   中英

Google App Engine PHP on windows

I'm trying to get started with using Google app engine with PHP (on Windows 7) and have been trying to follow the helloworld example here .

Problem I am having is in starting the webserver. Whenever I try to run it I get the error

dev_appserver.py: error: too few arguments

I'm typing the following at the command line:

google_appengine\dev_appserver.py --php_executable_path=c:\php\php-cgi c:\appengine\helloworld\

Any suggestions as to what I am doing wrong?

Cheers

Use quotes for arguments.

google_appengine\dev_appserver.py --php_executable_path="c:\php\php-cgi" "c:\appengine\helloworld"

Or use slashes instead of backslashes as directory separator:

google_appengine\dev_appserver.py --php_executable_path=c:/php/php-cgi c:/appengine/helloworld

For best results combine both methods ;)

So I was running into this issue, and tried every permutation of paths using quotes, and switching to the directory where appengine SDK was installed etc. Finally I realized that Python was running the script but it wasn't including the command line arguments being passed in. So I had to manually call python like this:

c:\<python_path>\python <sdk_path>/dev_appserver.py --php_executable_path=c:/php/php-cgi.exe helloworld/

I'm not a python guy so I don't know why the command line arguments got stripped, but I've had this issue with other applications in Windows 7

This answer solved the issue for me.

Just to clarify it a bit, here is how the value under

HKEY_CLASSES_ROOT\\Applications\\python.exe\\shell\\open\\command

should look in Windows regedit tool.

注册表:编辑字符串值

And it should be the same as the value under this path:

HKEY_CLASSES_ROOT\\Python.File\\shell\\open\\command

Solution tested on environment: Python 2.7.5 on Windows 7 (Home Premium) x64.

In fact I had this problem not with PHP App Engine but with Go App Engine. However, it is apparently not App Engine, but rather a Python+Windows issue.

I'm using Windows 7 too.

Here it's my code tested:

dev_appserver.py --php_executable=c:/php/php-cgi.exe c:/appengine/helloworld

Notice! I'm inside google appengine directory.

For example if you installed the SDK in C:

Write first cd google_appengine hit enter, and then use the upper code.

You have to either: give full path to dev_appserver.py

or

cd into the directory where you instaled it

If You followed example to the letter You would have instaled it in C:/{username}/something directory

and the call would be then something/dev_appserver.py as stated in example in helloworld!

Hovever - the example have one error in it: the directory they are proposing is not the same they are using in example call! Thats why make sure the "sometinhg" directory is the same in call as used to instal app engine

after I moved everything to c:\\ to simplify the paths I ended up calling it from the dos command prompt like this

C:>\\Python27\\python C:/google_appengine/dev_appserver.py --php_executable_path= C:/php/php-cgi.exe c:/google_appengine/helloworld/

And it works!

is the python command line tool the way we should be running this stuff?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM