Google App Engine for PHP with PhpStorm


Today’s guest post comes from Maarten Balliauw, Technical Evangelist at JetBrains, the vendor of smart developer tools such as IntelliJ IDEA, PyCharm, PhpStorm, Android Studio and many more.



At JetBrains we are building tools that aim to enhance developers’ productivity by automating routine tasks and helping you concentrate on coding.



Our IDE for PHP, PhpStorm, provides seamless integration with Google App Engine for PHP — allowing you to locally develop, debug and deploy your PHP applications on Google App Engine. When testing your application locally, we also support full emulation of App Engine services through the App Engine Development server.



The following video shows how to get started with Google App Engine for PHP in PhpStorm. We also have a comprehensive tutorial which covers Google App Engine with PhpStorm in detail.









When creating Google App Engine applications in PHP using PhpStorm, chances are that you’ll also be using Google Cloud SQL to store data. For these next steps, we will have assumed you have created a Cloud SQL instance from the Google Cloud Console.



PhpStorm, as well as IntelliJ IDEA and PyCharm, provides database management tools (see the right-hand side of the IDE or hit Ctrl+Alt+A (Cmd+Alt+A on Mac) and search for “Database”). You can use these built-in tools to create new tables, run arbitrary SQL commands and insert, update and delete data.



Opening the database pane, you can create a new connection or Data Source. You’ll have to specify the JDBC database driver to be used to connect to our database. Since Google Cloud SQL supports native MySQL connections, we can use the standard MySQL connector and enter connection details.




Connecting to a Google Cloud SQL database using PhpStorm database tools

The JDBC driver to use is com.mysql.jdbc.Driver, the database URL will be jdbc:mysql://:3306/ where cloudsql_ip_address is the IP address of our Google Cloud SQL instance, and database_name is the name of the specific database on that instance to which you want to connect.



As for database credentials, you can create a root user password through the Google Cloud Console or manually create a new user through PhpStorm using the following SQL statement:





CREATE USER user_here@% IDENTIFIED BY password_here;
GRANT ALL PRIVILEGES ON *.* TO user_here@% WITH GRANT OPTION;



You can now make use of these new credentials to connect to Google Cloud SQL and do things like create tables.






Creating a table in Google Cloud SQL using PhpStorm database tools

Now, from our PHP code, you can easily create a new connection to our Google Cloud SQL instance using PDO:




Connecting to a Google Cloud SQL database using PDO

Give it a try (a trial version is available for PhpStorm) and let us know your thoughts through the comments below.



-Contributed by Maarten Balliauw, Technical Evangelist, JetBrains
Read More..

Announcing Google App Engine education awards

In addition to the startups and businesses we frequently highlight on our blog, we have seen educational institutions and their students build amazing applications, using Google App Engine as a platform for teaching and groundbreaking research.



Earlier this year we announced funding for researchers looking to use App Engine for scientific discovery. Today we are introducing the Google App Engine Education Awards to foster continued innovation from educational institutions in areas outside of research. Through this program we are inviting faculty members, initially from the United States, to submit proposals for using App Engine for their course development, educational research, university tools or for student projects. A selection of the proposals we receive will receive $1,000 in App Engine credits to assist in making the proposal a reality.



App Engine allows you to build scalable applications using the same technology that powers Google’s global-scale web applications. With no hardware to setup, App Engine makes it simple to learn how to write a simple web application or to build an application that handles millions of hits a day. If you haven’t already tried App Engine, we encourage you to download the SDK, follow the Getting Started Guide and take advantage of our free tier to deploy your first application.



If you teach at an accredited college, university or community college in the United States, we encourage you to apply. You can submit a proposal by filling out this form. Applications must be received by midnight PST August 31, 2012.





- Posted by the Google App Engine Team
Read More..

App Engine SDK 1 3 5 Released With New Task Queue Python Precompilation and Blob Features

Today we are happy to announce the 1.3.5 release of the App Engine SDK for both Python and Java developers.


Due to popular demand, we have increased the throughput of the Task Queue API, from 50 reqs/sec per app to 50 reqs/sec per queue. You can also now specify the amount of storage available to the taskqueue in your app, for those with very large queues with many millions of tasks. Stay tuned for even more Task Queue scalability improvements in the future.


Additionally, in this release we’ve also added support for precompilation of Python source files to match the same feature we launched for Java last year. For Python, you can now use precompilation to speed up application loading time and to reduce CPU usage for new app instances. You can enable precompilation by including the following lines in your app.yaml file:


derived_file_type:

- python_precompiled

This will start offline precompilation of Python modules used by your app when you deploy your application. Currently precompliation is off by default for Python applications, but it will be enabled by default in some future release. (Java precompilation has been enabled by default since the release of 1.3.1.)


To give you a taste of what this feature is like, we tested this on a modified version of Rietveld (which included a copy of Django 1.0.4 in the app directory, and which did not use the datastore in its base url). The latency and CPU usage results for the initial load of the application, after uploading a new version of the app and requesting the homepage, were:



Before precompilation enabled:

Test 1: 1450ms 1757cpu_ms

Test 2: 1298ms 1523cpu_ms

Test 3: 1539ms 1841cpu_ms

After precompilation enabled:

Test 1: 805ms 669cpu_ms

Test 2: 861ms 702cpu_ms

Test 3: 921ms 803cpu_ms

Of course, any individual app’s performance will vary, so we recommend that you experiment with the setting for your application. Please submit your feedback and results to the support group!


In addition to Task Queues and Python precompilation, we have made a few changes to the Blobstore in 1.3.5 We have added file-like interfaces for reading Blobs. In Python, this is supported through the BlobReader class. In Java, we have implemented the BlobstoreInputStream class, which gives an InputStream view of the blobs stored in Blobstore.


More information on this release can be found by reading the release notes for Python and Java.



Read More..

Blog Archive

Powered by Blogger.