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.
Related
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
I'm trying to link php files on Google cloud storage, but getting them as plain text. I want to connect to the other file but without App Engine, all the documentation of this is written exclusively for app engine and can't even find if bucket storage has php support even tho it should. Any clue of how to link a PHP file correctly on Cloud Storage?
Google cloud storage is storage service which can store your object(files) and return when you ask for it.Files like HTML,JavaScript and CSS that render inside browser can be placed on google cloud storage to get performance in loading time.But in your php file need execution engine to run it code.Placing them on storage and accessing will get to file context.
I'm lost in trying to decipher google's documentation for using cloud storage. All of the documentation that I have been able to find for PHP and Google Cloud seem to be for services running on google cloud. The snippet below uses the gs://my_bucket/new_file.txt as an example.
$gs_name = $_FILES['uploaded_files']['tmp_name'];
move_uploaded_file($gs_name, 'gs://my_bucket/new_file.txt');
This does not however tell me how to upload images from remote server.
I've looked for PHP libraries and checked composer but can't seem to find what I need. All I want to do is upload a file to the cloud, get the URL of the image and save the url to serve later on. Clean and simple.
I'm currently doing this on S3 and it was all very straight forward and easy to get up and running. For some reason I am missing something here.
Can anyone shed some light, or am I trying to do something google cloud wasn't designed for?
When the app runs locally, the gs:// path is mapped to a local GCS emulation layer. You can use Developer Console or gsutil to work with the production GCS.
) 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 want to develop a website like file manager. Where user register and will get fix disk space lets say 20MB.
Now user can upload their pdf, doc, txt, jpeg etc files upto their disk limit.
I can develop upto this using PHP.
Now below is my issue:
1) If user's files are corrupted they can rollback their folders before 2-3 days.
Files must be secure and safe from viruses as users are uploading their important documents.
Is there any 3rd party storage server who provides such facility?
2) Also all files should be previewed from browser.
I am using Google doc viewer. Is is good and safe way to preview file in browser?
But google links are accessible from all, I need to add some restrictions as file can be viewed only by their owner.
I know it's a major task, but i just need some sort of logic. Please share your thoughts.
Thanks.
Any cloud storage service can be used for this. You'll get HDD space. There is not storage server who provides revision control system for this. You can use git, svn for this though. But as the files are binary you can not get full facility of these tools.
How file will be previewed depends on you. If you use PHP you make the site and at the backend you use the API to interact with the storage service. Google doc is not an option for this if you use PHP. Also note Google links can be made private.
I suggest you this,
Find a cloud storage service and use the storage in your server. Any will do.
Create UI using PHP and control the access using PHP too.
Manipulate files in your server directly or in 3rd party storage server via API
Use a revision control system to track the changes. And use its API in PHP end.
Some cloud storage service
Amazon S3. It also supports Versioning.
Google Cloud Storage
Microsoft Azure
Try Microsoft SkyDrive or Google Drive or Dropbox