3

I tried to follow the instructions on https://cloud.google.com/appengine/downloads#Google_App_Engine_SDK_for_PHP

When I start up the app engine with the hello world example like this:

go_appengine/dev_appserver.py --php_executable_path=/home/jan/php-5.4.25/installdir/bin/php-cgi helloworld/

I get a error in the console saying: ERROR php_runtime.py:348] The PHP runtime is not available

If I go to localhost:8080, I get:

The PHP interpreter specified with the --php_executable_path flag ("/home/jan/php-5.4.25/installdir/bin/php-cgi") is not compatible with the App Engine PHP development environment.

No input file specified.

I thought maybe they just refered to an old version or something in the docs, so I also tried the same method with php 5.5.30, and even just apt-get php5-cgi changing php_executable_path each time with the same result.

This is on a fresh install of ubuntu 14.04 on a VM.

Anyone know what's going on here?

EDIT:

app.yaml

application: helloworld
version: 1
runtime: php55
api_version: 1

handlers:
- url: /.*
  script: helloworld.php

OUTPUT:

INFO     2016-01-05 12:11:42,024 sdk_update_checker.py:229] Checking for updates to the SDK.
INFO     2016-01-05 12:11:42,299 sdk_update_checker.py:257] The SDK is up to date.
INFO     2016-01-05 12:11:42,355 api_server.py:205] Starting API server at: http://localhost:37460
INFO     2016-01-05 12:11:42,357 dispatcher.py:197] Starting module "default" running at: http://localhost:8080
INFO     2016-01-05 12:11:42,360 admin_server.py:116] Starting admin server at: http://localhost:8000
ERROR    2016-01-05 12:11:43,418 php_runtime.py:348] The PHP runtime is not available
Traceback (most recent call last):
  File "/appengine/google/appengine/tools/devappserver2/php_runtime.py", line 344, in new_instance
    self._check_binaries(php_executable_path, gae_extension_path)
  File "/appengine/google/appengine/tools/devappserver2/php_runtime.py", line 284, in _check_binaries
    cls._check_environment(php_executable_path, env)
  File "/appengine/google/appengine/tools/devappserver2/php_runtime.py", line 259, in _check_environment
    raise _PHPEnvironmentError(check_process_stdout)
_PHPEnvironmentError: No input file specified.
4
  • Have you tried running it without specifying the --php_executable_path? I would have assumed a compatible runtime was provided with the PHP SDK. Jan 5, 2016 at 8:32
  • Yes. This gives me the "PHP runtime is not available". The development server must be started with the --php_executable_path flag set to the path of the php-cgi binary
    – jan
    Jan 5, 2016 at 8:38
  • Have you tried apt-get install php5-cgi instead of apt-get install php5? I believe that's the correct package. (source: stackoverflow.com/questions/20618871/…) Jan 5, 2016 at 8:42
  • Typo. Sorry. That's the one I tried. Edited the question now.
    – jan
    Jan 5, 2016 at 8:43

2 Answers 2

2

Does the same error appear on multiple projects/apps or just one project/app? Is your app.yaml configured to display PHP pages properly?


The official documentation on this subject did not work for me either (and does not cover PHP 5.5 usage instructions).

I had to compile a custom PHP 5.5 CGI binary for my PHP SDK on Ubuntu 14.04.

Note: the following worked on my system, and there might be some variables per system which need adjusting.

Download the source for PHP 5.5.30 and open the directory in your terminal

$ cd /downloaded/php/source/dir/path

ls should display a configure file inside the directory. Then inside the source directory run a configure as follows (\ for formatting, can be left out and make the command one-line):

$ ./configure --prefix=/php/5.5/ \
    --enable-bcmath \
    --enable-calendar \
    --enable-ftp \
    --enable-mbstring \
    --enable-opcache \
    --enable-soap \
    --enable-sockets \
    --enable-zip \
    --disable-fileinfo \
    --disable-flatfile \
    --disable-posix \
    --with-curl \
    --with-gd \
    --with-openssl \
    --without-sqlite3 \
    --without-pdo-sqlite \
    --without-imap \
    --without-kerberos \
    --without-imap-ssl \
    --without-interbase \
    --without-ldap \
    --without-mssql \
    --without-oci8 \
    --without-pgsql \
    --without-pear \
    --disable-phar \
    --with-pdo-mysql=mysqlnd \
    --with-mysqli=mysqlnd \
    --with-mysql=mysqlnd

Then just

$ sudo make && sudo make install

The prefix then sets the make && make install commands to install the php-cgi binary into /php/5.5/bin/php-cgi, which is the binary to use in the SDK's --php_executable_path (i.e. --php_executable_path=/php/5.5/bin/php-cgi).

Additionally, make sure the PHP SDK has the permission to run the php-cgi executable some way, e.g. chown the PHP installation to the same user who runs the SDK.

Note: if you try to install php-memcache(d) for the SDK executable, the SDK will not work with it. As far as I know the SDK uses some internal mechanism to emulate memcached usage in the dev server. Some other extensions also trigger SDK errors like this.

4
  • Thank you for the suggestion, but it did not help:/ Still get the same error.
    – jan
    Jan 5, 2016 at 11:28
  • Could share the app.yaml you're using? Maybe paste that to your question so we can review it for possible problems. Also, could you run the dev server start command with some debug turned on (I think the option --noisy made it more verbose)?
    – ojrask
    Jan 5, 2016 at 11:44
  • After reading the source code in dev_appserver2.py there are a number of things that can go wrong regarding this problem: 1) The executable file does not exist. 2) The php-cgi file is not executable (chmod). 3) Python's safe_subprocess cannot get a proper PHP 5.4+ version number from php-cgi -v. 4) PHP's auto_prepend_file and auto_append_file INI-directives cannot be altered through the SDK Python code (using cli flag -d). Could you please verify that the php-cgi file actually exists in the desired location and that it is executable (sudo chmod +x php-cgi to be sure).
    – ojrask
    Jan 5, 2016 at 13:24
  • I can verify that the file does exist and I have run chmod +x with no luck. -v gives 5.5.30 (cgi-fcgi) (built: Jan 5 2016 08:43:49)
    – jan
    Jan 5, 2016 at 14:04
0

Sorry, but I had downloaded the SDK for Go instead of PHP. Thank you for trying to help me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.