Google App Engine PHP on windows

2019-06-25 04:09发布

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

6条回答
再贱就再见
2楼-- · 2019-06-25 04:34

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 ;)

查看更多
霸刀☆藐视天下
3楼-- · 2019-06-25 04:39

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?

查看更多
Rolldiameter
4楼-- · 2019-06-25 04:46

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.

查看更多
三岁会撩人
5楼-- · 2019-06-25 04:46

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

查看更多
霸刀☆藐视天下
6楼-- · 2019-06-25 04:48

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

查看更多
▲ chillily
7楼-- · 2019-06-25 04:51

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.

Regedit: Edit String Value

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.

查看更多
登录 后发表回答