I have previously developed 1 website using php and mysql now I want to deploy it on Google cloud platform.
It will be great if someone only point out steps for below points
1.install PHP 7.x
2.creating .YAML files
3.creating mysql databse
4.upload my PHP file
5.FTP setup
Thank you
You can start setting up you environment like the documentation describes.
For creating ".YAML" files there is also documentation by google.
To create your MySQL database you should check this documentation about creating Cloud SQL.
To upload PHP file you can use follow the documentation and learn more about Cloud Storage and how to upload objects.
About ftp setup, can you specify why you trying to achieve using it? If you want to transfer files you can you see again the documentation of 4.
You can find a large set of example applications for deploying to App Engine here, or on cloud.google.com.
Try to use Google App Engine - this is the easiest way to deploy app withount install LAMP and FTP. Withount MySQL its free! See the quickstart: https://cloud.google.com/appengine/docs/standard/php7/quickstart
Answering your question in the comment;
I've created .YAML file and also created MySQL databse and uploaded
all PHP files to bucket as shown in step 4. now how can I create URL
that call the Index.php ?
If you deploy your app in App Engine you don't necessarily need to upload all your application files to Cloud Storage because App Engine will put your static files in a managed static files server. You only need to set this in the app.yaml file.
I suggest you to take a look at the this sample application's files , so you can have a good idea on how to set all configuration files in order to deploy your app to App Engine standard environment and connect to Cloud SQL.
App Engine will create a default URL for you app under appspot.com domain, check for details here.
For more information on how you can connect to Cloud SQL from GAE standard take a look here.
Just follow steps
here
it will help you setup LAMP server and upload files to server using FTP
(which you can connect using SMTP-keyfile method) and also this document help you to setup mySQL database
Related
I have project that needs to output hundreds of photos from one template file, compress them into a .zip file, and push them to the customer's browser. After that, the .zip file can be deleted.
Google App Engine (PHP) does not allow you to write files like you would in a standard web server.
How can this be accomplished with GAE flexible?
As you have already known, App Engine flexible does not allow you to write files on the system even if it runs on a VM. The reason is that it runs within more Docker containers and you will not have the guarantee that you will find the file.
An alternative for this is to change a bit your workflow and to use Cloud Storage as an intermediate. You can send the photos directly to Cloud Storage, and the users will be able to download them directly from Cloud Storage. Here you have a guide on how to achieve this from App Engine flex for PHP.
Our website coded in php language was designed by some third party. Our whole project code with its database is in Azure. We now want to make changes to it and update it but we do not know how to retrieve php code of website from Azure. Any help will be highly appreciated.
Thank you in advance!
If you have access to the Azure Subscription where you app is hosted, you have several options.
Download the publishing profile and use FTP/S. This file will have FTP username and password.
Use the Kudu Environment (https://.scm.azurewebsites.net)
Use the App Editor (https://.scm.azurewebsites.net/dev)
If Continuous Deployment was configured you could grab the code from the repo (assuming you have access to the repo).
We use a Flexible Environment with Google App Engine for our PHP Website (Laravel) and cannot figure out how to download current website image from Google App Engine with flexible environment setup. As I now have a new developer, we need this latest version for a backup purpose and for future improvement. The idea is to get the latest code from there and also the database, which is even more important, as website already has data and users on it (it is live now, in beta).
We also have a GitHub account setup. If we could load an image from the cloud to GitHub, that could work as well.
You may be able to find the source code here:
https://console.cloud.google.com/debug
Alternatively, since you are using GAE Flex, you could ssh into your instance to try to find it:
https://cloud.google.com/appengine/docs/flexible/php/debugging-an-instance#connecting_to_the_instance
As for the Database, the answer depends on 1) which database you are using (google datastore vs google cloud sql, etc) and 2) what you intend to do with it.
For example, Google datastore has datastore admin which can retrieve a snapshot of the database (https://console.cloud.google.com/datastore/settings), but the output is not something standard like csv. It's primarily used for backups & restores. But you can use this to clone your database into another app engine project
In order to copy anything from a VM on google Cloud platform, you first need to access the docker via SSH (command: sudo docker exec -it gaeapp /bin/bash). When inside of docker, you need to archive everything you need into TAR.GZ format (or try rar or zip, my server only supported TAR.GZ), once archived, you need to copy that outside of docker, which i already forgot how I have done that (oops). But google will help. Once done there will be a very non obvious gear icon on your SSH window top right where you can simply click download file and enter a file name. Choose your archive and vuala.
) i am creating a php application in google appengine. Since i will have to pay for the cloud sql, i decided to use some files instead of the sql database and read/write from it. but the problem is i am not able to create or modify the existing files using php's standard file operations like 'fopen' and 'fwrite',etc. when i run the same code in 'localhost:8080' it is working properly. but not in the uploaded version in internet. i am getting errors while creating/writing to the files. please help. thank you
You should read the appengine php runtime docs https://developers.google.com/appengine/docs/php/#PHP_The_sandbox
Specifically the section about the sandbox. The crucial statement -
An App Engine application cannot:
write to the filesystem. PHP applications can use Google Cloud Storage
for storing persistent files. Reading from the filesystem is allowed,
and all application files uploaded with the application are available.
This was a while ago, but if you still want to write to file system, you can write to the gs cloud
https://cloud.google.com/appengine/docs/php/googlestorage/#writing_files_from_your_app
you need to add the bucket to your php.ini file
google_app_engine.allow_include_gs_buckets="yourapp.appspot.com"
and make sure your Service Account Name has permissions to edit the cloud storage
HTH
I start to use GAE with PHP. On documentation we can't find any information about Blobstore.
So the only way to upload image it's to upload image on PHP application is Cloud Storage ?
Thx
Samuel
Yes no blobstore - only persistent storage is Google Cloud Storage.
In the current PHP SDK (1.89), in the PHP libs directory (<path to>\Google\google_appengine\php\sdk\google\appengine\api\blobstore) you can see that there is a blobstore directory, and a single blobstore_service_pb.php file. It is missing the BlobstoreService.php and BlobstoreException.php files.
However, you can get pre-release version from googles git site:
https://chromium.googlesource.com/external/googleappengine/python/+/b90ec6c60be569887e4905737fc5b2fedd9fe336%5E/php/sdk/google/appengine/api/blobstore/
Download the two required files, stick it in your Google appengine SDK blobstore directory and use it.
require_once 'google/appengine/api/blobstore/BlobstoreService.php';
use google\appengine\api\blobstore
Works locally on the development server... Not sure if the files exist on the actual app engine service, as I haven't pushed a test app to the servers yet.
PHP in GAE is in experimental stage and for now not every API is available. There's no ETA. You can try to make for example python "backend" that will handle your blobs and call it from your PHP side.