No input file error from dev_appserver.py - php

I am trying to create a helloworld GAE projects to use PHP to connect to a Google Cloud SQL database. I am following the steps found at:
https://developers.google.com/appengine/docs/php/gettingstarted/helloworld
However, whenever I start the dev_appserver.py to test my helloworld.php I eventually get a permission denied error. I am running Cygwin (mintty) on a Win8 (64) machine. I have run chmod -R 777 * on a number of related directories like:
/usr/bin/
c:/Development/appengine-php-sdk-1.8.0/
c:/Development/php/
c:/Development/Php Scripts/helloworld/
Error:
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
How can I determine what file the permission issue is with?
EDIT
There is no traceback from this new error (now that I am calling the actual 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.
Then when I go to localhost:8080 I get this:
`The PHP interpreter specified with the --php_executable_path flag ("/cygdrive/c/Development/php/php-cgi.exe") is not compatible with the App Engine PHP development environment.
No input file specified.`

The problem is in your command line:
appengine-php-sdk-1.8.0/google_appengine/dev_appserver.py --php_executable_path=/cygdrive/c/Development/php/ /cygdrive/c/Development/PhpScripts/helloworld/
Your php_executable_path is not an executable, but a directory. So, GAE tries to run /cygdrive/c/Development/php/ as if it were a program, and gets an EACCES ("permission denied"), exactly as it should.
The fix is to pass /cygdrive/c/Development/php/php.exe (or whatever it's called) instead.
I believe your new problem is exactly what I mentioned in an early comment, and in the earlier version of this answer: You're mixing cygwin and native code in ways that don't work.
In particular, it looks like you're running a native Windows version of GAE in a cygwin Python interpreter, and then pointing it at a native Windows php-cgi interpreter. It's hard to guess exactly which one of these multiple mismatches is to blame, but it's quite likely that one of them is. So, either:
Use a native Windows Python, or
Use a cygwin/POSIX GAE and a cygwin PHP interpreter.

Related

unable to use dev_appserver.py to run the local development server on mac

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.

Unable to run google app engine script with PHP

So, I'm trying to run the Hello World script but whenever I run dev_appserver.py I hit a wall.
Here's the error log from the script:
$ appengine/dev_appserver.py --php_executable_path=/usr/local/bin/php-cgi HelloWorld
...
ERROR 2016-03-29 12:57:30,588 php_runtime.py:348] The PHP runtime
is not available Traceback (most recent call last): File
"/Users//desktop/appengine/google/appengine/tools/devappserver2/php_runtime.py",
line 344, in new_instance
self._check_binaries(php_executable_path, gae_extension_path) File
"/Users//desktop/appengine/google/appengine/tools/devappserver2/php_runtime.py",
line 284, in _check_binaries
cls._check_environment(php_executable_path, env) File "/Users//desktop/appengine/google/appengine/tools/devappserver2/php_runtime.py",
line 259, in _check_environment
raise _PHPEnvironmentError(check_process_stdout)
_PHPEnvironmentError: No input file specified.
As a background to my El Capitan setup...
I've previously updated PHP to 5.5 using:
curl -s http://php-osx.liip.ch/install.sh | bash -s 5.5
But I've also downloaded via HomeBrew php54 and that's what should be running the php-cgi script I've posted in the executable path above.
Any thoughts?
So turns out, the answer was pretty obvious - I'd installed the Go SDK rather than the PHP one! Google's website scrolls to the wrong place when you click PHP. Many hours wasted trying to fix this one - never mind. Hope this helps another as simple as me!
if you already installed google-cloud-sdk run this command :
gcloud components install app-engine-php-darwin
you won't need to specify that path after this

GAE - php5.5 - The PHP runtime is not available

I am trying to run a helloworld gae php program locally, but get error when I start the server.
My environment:
linux mint mate 17 php5.5 php-cgi5.5 python2.7.6 gae_php_1.9.17
The error info I get when try to start web server in gae locally:
INFO 2015-02-08 16:17:32,197 api_server.py:172] Starting API server at: http://localhost:54892
INFO 2015-02-08 16:17:32,201 dispatcher.py:186] Starting module "default" running at: http://localhost:8080
INFO 2015-02-08 16:17:32,202 admin_server.py:118] Starting admin server at: http://localhost:8000
ERROR 2015-02-08 16:17:33,204 php_runtime.py:227] The PHP runtime is not available
Traceback (most recent call last):
File "/mnt/star/program/gae/gae_php_1.9.17/google/appengine/tools/devappserver2/php_runtime.py", line 223, in new_instance
self._runtime_config_getter().application_root)
File "/mnt/star/program/gae/gae_php_1.9.17/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.
Any suggestion?
Looks like you're not passing --php_executable_path (it's showing up as an empty string, its default). Running:
dev_appserver.py --php_executable_path=/usr/bin/php-cgi yourapp
may therefore work better for you.

Path specified --php_executable_path does not exist -- GAE php HelloWorld

Setup the GAE PHP sandbox on my Linux laptop (running Debian 'Wheezy' 32-bit, latest packages). Setup was done following the 'Installing the SDK' instructions, followed by an attempt at the 'Getting-Started > Hello World' application, following the instructions.
However, when I visit http://local.host.com:8080*, I get the following message, instead of 'Hello World!':
The path specified with the --php_executable_path flag () does not exist.
*Note: SO doesn't allow URL pointing to localhost, so replaced it with local.host.com! It is not a mistake.
On the console where I'd started the app_server, I see the following error-message:
ERROR 2014-04-29 03:34:36,219 php_runtime.py:223] The PHP runtime is not available
Traceback (most recent call last):
File "/home/icarus/google_appengine/google/appengine/tools/devappserver2/php_runtime.py", line 219, in new_instance
self._check_environment(php_executable_path)
File "/home/icarus/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.
Note that I've installed the latest php-5.4.27 (instructions talk of php-5.4.25, but later go on to say in a NOTE that we can get the latest from PHP website), and built it on my machine, successfully as per instructions.
Is the php-5.4.25 hardcoded anywhere, s.t. it is not found, as on my machine I've got php-5.4.27 ? Here is what I see:
$ ls -l ~/php-5.4.27/installdir/bin/php-cgi
-rwxr-xr-x 1 icarus icarus 23195302 Apr 28 22:58 php-cgi
Python installed is 2.7.3, and the google_appengine SDK is latest stable i.e. 1.9.3.
Argh... I ignored to see the plethora of questions already on SO, on this (or nearly this) subject, most perhaps from newbies like me.
Based on this other SO question's answer, I started the SDK like this:
$ google_appengine/dev_appserver.py --php_executable_path=php-5.4.27/installdir/bin/php-cgi work/gae_apps/helloworld/
and finally 'Hello World!' worked as expected. Perhaps, this calls for bit of clarification / elaboration on the 'Getting Started' page ?

PHPStorm does not read the entire path to the php interpretator

Hi I just installed PHPStorm 5 for the first time to give it a try and I seem to be having a problem in running PHP applications.I have installed xampp and the path to the PHP interpretator has been set to:
D:\Program Files\xampp\php\php.exe
When I try to run I php file I get this error:
"D:\Program Files\xampp\php\php.exe" D:\Program Files\xampp\php\php.exe "D:\Program Files\xampp\htdocs\PHPStorm\Project\index.php"
Could not open input file: D:\Program
Process finished with exit code 1
For some reason it seems that PHPStorm does not read the rest of the path and it stops at D:\Program.
How can I correct this problem besides changing the name of the folder because that would require me to reinstall almost everything on my computer again?
EDIT RUN CONFIGURATION
Look the full command-line:
"D:\Program Files\xampp\php\php.exe" D:\Program Files\xampp\php\php.exe ⤦
"D:\Program Files\xampp\htdocs\PHPStorm\Project\index.php"
You are using the command:
"D:\Program Files\xampp\php\php.exe"
With the following three parameters:
D:\Program
Files\xampp\php\php.exe
"D:\Program Files\xampp\htdocs\PHPStorm\Project\index.php"
You php.exe then tries to open the "file"
D:\Program
and naturally fails. Instead your command should be:
"D:\Program Files\xampp\php\php.exe" c:\path\to\your\script.php
Obviously you did enter the text D:\Program Files\xampp\php\php.exe into too many textboxes as it belongs to. If you're new to PHPStorm I suggest you read the online manual:
Interpreters - PhpStorm 5.0 Web Help
Run/Debug Configuration: PHP Script - PhpStorm 5.0 Web Help
It's also available by pressing F1 when you're in a dialog.
Edit: Clear the field named Interpreator Options

Categories