Does my PHP project need appengine-web.xml - google-app-engine

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.

Related

GAE: No longer able to update my Gaelyk project due to appcfg losing support

Recently tried to update my Gaelyk project (yes, it's old, but it works well and I still use it), but Google App Engine will no longer accept the update. The error message returned is "Deployments using appcfg are no longer supported. See https://cloud.google.com/appengine/docs/deprecations". The thing is, I never used appcfg to deploy my application; I used Gaelyk and Gradle. But obviously Gaelyk must have used appcfg under the covers.
I did download the replacement Google Cloud SDK, but this new tool is not similar at all to how Gaelyk and Gradle worked. Is there anything I can do to get Gaelyk to work anymore? Or is Gaelyk just dead and I need to rewrite my application (like in Node.js or something instead of Groovy).
This will be hard, however I will try to help you as possible. I think you may try to migrate it somehow to app.yaml configuration of GAE.
I am not sure what plugins are used in the project. From Gaelyk temple project I can see that it's using appengine-geb which, according to the documentation, behind the scenes, is using gradle-appengine-plugin (there is wrong link on this doc, but proper is bellow).
On the github of gradle-appengine-plugin I have found following.
There is a note:
NOTE: All App Engine users are encouraged to transition to the new
gradle plugin for their projects.
And in FAQ part there is following information:
How do I deploy with gcloud?
If you're using gcloud to deploy your application, the newest version of app deploy > doesn't support war
directories, you will need to provide it with an app.yaml OR you can
use the appengineStage task to create a directory that is deployable
in /build/staged-app
$ ./gradlew appengineStage
$ gcloud app deploy build/staged-app/app.yaml --project [app id]
--version [some version]
NOTES:
You must explicitly define all config files your want to upload
(cron.yaml, etc)
This does not work with EAR formatted projects.
I think the best option will be to migrate to new appenine plugin or if not possible try to implement is with gcloud app deploy command crating the config files manually (at least app.yaml). And for this migration I can provide you this document.
I hope you will manage somehow...
I can confirm that Serge's answer on the Gaelyk Groups site works; the same procedure that he figured out also worked for me. To summarize:
Run gradlew appengineRun as run previously with Gaelyk.
Copy all jar files inside the build\exploded-app\WEB-INF\lib folder into a \src\main\webapp\web-inf\lib folder (for me the new lib folder did not exist previously).
To deploy, use the new required gcloud tool, and instead of running gradlew appengineUpdate (which fails now), instead run
gcloud app deploy appengine-web.xml where that XML file can be found in your webapp/WEB-INF directory. I navigated to that directory to run the gcloud command, but you can use a relative path there if your working directory is elsewhere. (There are a number of optional flags associated with the gcloud app deploy command, but I didn't need any of them.)
Serge needed to use these instructions to convert datastore-indexes.xml to index.yaml and run gcloud app deploy index.yaml, however, I didn't need to do this because I had no datastores.

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.

What am i doing wrong here? Anytime i execute this line it directs to one directory

Anytime i try executing "gcloud app deploy", below is what i get. I just don't know why.
C:\Users\charl\Desktop\Apps\webTest\webTest>gcloud app deploy ERROR:
An app.yaml (or appengine-web.xml) file is required to deploy this
directory as an App Engine application. Create an app.yaml file using
the directions at
https://cloud.google.com/appengine/docs/flexible/python/configuring-your-app-with-app-yaml
(App Engine Flexible Environment) or
https://cloud.google.com/appengine/docs/standard/python/config/appref
(App Engine Standard Environment) under the tab for your language.
ERROR: (gcloud.app.deploy) [C:\Users\charl] could not be identified as
a valid source directory or file.
App Engine comes in two flavors: the classic "App Engine Standard" and the newer "App Engine Flex(ible)".
Both require some configuration in order for the App Engine service to understand how you wish to run your app. In many instances, this configuration is with a file called app.yaml. For App Engine Standard for Java, the file is called appengine-web.xml. You'll need to create one of these two files for your app before you can deploy it.
The error message you received is helpful. It provides you with links to help you create the file you will need for a successful deployment.

How is my GAE app able to run without app.yaml?

Although I started development for Google App Engine using Endpoints a while ago, I hadn't noticed this - Google's ref. page for Project structure says this:
Your development file hierarchy should look like this:
MyDir/
[pom.xml]
[build.gradle]
[index.yaml]
[cron.yaml]
[dispatch.yaml]
src/main/
appengine/
app.yaml
docker/
[Dockerfile]
java/
com.example.mycode/
MyCode.java
webapp/
[index.html]
[jsp.jsp]
WEB-INF/
[web.xml]
You'll need to define an app.yaml file that looks like this:
...
Note that the app.yaml is deemed compulsory as per the docs. In my case, I spawned a backend module(through the Wizard) in Android Studio that builds on Gradle. I have been able to build and deploy this module on GAE successfully but now I needed to switch from automatic scaling to basic/manual scaling, I found this to be done through app.yaml file.
Here is the thing: I don't have an app.yaml in place and it works fine. Where is then the config info. that GAE requires to deploy the App.
Specifically,
app.yaml specifies the environment - Java. But, I found the java plugin in build.gradle for that. Aren't 2 config places for the same thing confusing?
Is it possible to ditch app.yaml entirely for equivalent config. in build.gradle?
Why is Google claiming app.yaml to be compulsory when I am able to do without it?
The App Engine Java runtime uses its own configuration schema in XML, while others are YAML.
To set the scaling elements, follow the official reference.

Do I need an app.yaml for my App Engine project?

I keep reading in App Engine references about configuration directives that go into app.yaml, such as 'DBG_ENABLE'. But I can't find this file in my Android Studio created GAE project. Furthermore, I find that some of the directives in this file (for instance: Scaling) also have equivalent in appengine-web.xml.
So, what's the deal with this yaml file - do I need to create it? Where?
There is no app.yaml file created by Android studio, because usually you use Java Serverlet to implement the App Engine Application under Android Studio, it uses the /WEB-INF/appengine-web.xml file to configure the project.
The app.yaml file is used for the App Engine Project using Python, Go and PHP.

Resources