PhpStorm / Google AppEngine with PHP7 - google-app-engine

I recently deployed my app using Google App Engine. I installed Google Cloud SDK and I'm using PhpStorm.
When I run my app using runtime : php55, it works. But I need PHP 7!
When I try with
runtime: php
env: flex
A error occured : flex, only the following runtimes are allowed: ('python-compat', 'java', 'java7', 'go', 'custom')
Do you have an idea?
Here is my app.yaml config:
Here is my composer.json config:
Here is my PhpStorm config:

As answered in the comments to the question, I see you are working with the Development Server, which does not support the Flexible Environment. The Development Server only supports the runtime environments available for App Engine Standard, which are Java 7 (now deprecated) and 8, Go 1.6, Python 2.7 and PHP 5.5.
However, it also supports custom environments, which allows you to work in any programming language just by supplying a base Dockerfile image that configures the runtime environment (in your case you can build yourself an appropriate image with a PHP 7 environment or download it from an existent repository). It requires of course some more complex configuration and management than that of the provided Development Server, but right now, that is the only way you will be able to work with PHP in the development for App Engine.
So the configuration of your application should be correct, it is just that the Development Server does not yet support the Flexible Environment that you need to develop in PHP 7.

Related

AssertionError constantly appearing when I try to use on Google App Engine SDK

The following error keeps appearing whenever I try to do
dev_appserver.py app.yaml
File "/Users/monikap/Desktop/test-dir/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 95, in
assert sys.version_info[0] == 2
AssertionError
I have Python version 3.7 installed on my Mac
The development server still needs python 2 installed, even for python 3 apps, see Python 3.7 Local Development Server Options for new app engine apps
Python3 now has GA support on Cloud SDK.
I think you need to update your Cloud SDK with gcloud components update.

GAE PDO not support sqlsrv

I use Laravel with Sql Server in GAE, but I get error "could not find driver",
so I echo phpinfo in my site, and I found GAE PDO not support sqlsrv also not support pdo_sqlsrv.....
Is anyway I can fix that?
※I test my local environment is work, only GAE have this problem!
As mentioned in the The PHP Runtime documentation of the App Engine Flex, you can enable an extension by adding a php.ini to the root of your app before deploying it.
For installing drivers you will need to extend the runtime by creating a custom one, based on the basic PHP runtime available for App Engine. This will generate a Dockerfile in which you can add the necessary steps to install what you need.
This only works for App Engine Flex however, as you will need to deploy the Custom Runtime with the Dockerfile at the root of your app's folder.

Does my PHP project need appengine-web.xml

Setting up IntelliJ IDEA to run my PHP Wordpress (for App Engine) projects. Google Cloud Tools installed.
Have imported existing project files and then went to Tools > Google Cloud Tools > Run on a local App Engine Standard dev server.
An error is returned:
Project does not contain App Engine Standard modules: To use the App Engine Standard local development server, the project must contain at least one App Engine Standard module with an appengine-web.xml configuration file.
I read up on appengine-web.xml and apparently its used for Java projects. I'm trying to run PHP at the moment.
I haven't dealt with this file type before, is it similar to app.yaml?
Do I need this fie to set up my local server for PHP?
Actually the file appengine-web.xml corresponds to the App Engine Java runtime, you don't need to use it in your PHP project. It is similar to the app.yaml in the sense that it is where you define your default service.
In order to define the default service in your PHP app, you need the app.yaml. There are also optional configuration files, such as:
dispatch.yaml, queue.yaml, index.yaml, cron.yaml, dos.yaml
On a side note, maybe PHP Storm or Eclipse with the PHP Development tools are more suitable for your use case.

One or more modules in this project use a version of App Engine that does not support Java 8

I have a Google App Engine project in IntelliJ. I have been working on it for a while but suddenly I can't launch the local development server from IntelliJ anymore.
When I launch Intellij I get this message in Event log:
Java language level not supported: One or more modules in this project use a version of App Engine that does not support Java 8. Please click here to automatically change them to use the Java 7 language level.
If I try to launch the local server I get this error:
Error running 'Google App Engine Standard Local Server'
Error running Google App Engine Dev Server.
Exception occurred : com.google.cloud.tools.appengine.api.AppEngineException
Exception message : java.nio.file.NoSuchFileException: WEB-INF\appengine-web.xml
I can see from my version control system that appengine-web.xml or build.gradle have not changed.
If I run 'gradlew appenginerun' it works ok.
How can I see what modules are not supported on Java 8?
I imported the project again from gradle.
Seems to work now.

Substiitute of dev_appserver.py of Google App Engine [Need to upgrade to FLEXIBLE environment]

I have a Flask-restful API(micro-service) written in python 2.7 using Google Cloud STANDARD environment, and dev_appserver.py(gcloud sdk) helps to run it locally.
Now, I plan to do three things:
Upgrade the code from Python 2.7 to Python 3.5
Google Cloud STANDARD environment to Google cloud FLEXIBLE environment
Question: but standard environment uses AppEngine library and methods, that don't work in flexible environment, so, can Google Cloud Client libraries solve the purpose?
Run locally and test the micro-service
Question: Please give suggestions to replace dev_appserver.py
There are a lot of differences between the environments. A lot of methods and libs from standard won't work in flex.
See here for more info:
https://cloud.google.com/appengine/docs/the-appengine-environments
https://cloud.google.com/appengine/docs/flexible/python/flexible-for-standard-users
https://cloud.google.com/appengine/docs/flexible/python/migrating
You can't use dev_appserver.py in flex environment. You will need to run Flask the regular way. e.g (locally) FLASK_APP=main.py FLASK_DEBUG=1 python -m flask run --port 8080

Resources