0
votes

I'm new to app engine and trying create a php app from a sample code. Can anyone please tell me what is the use of

require_once DIR . '/vendor/autoload.php';

Is this set of libraries we need to download? I'm developing/test locally and deploying in to gcloud project using 'gcloud app deploy'

I can use use google\appengine\api\users\User;

but I cannot use use google\cloud\storage\StorageClient;

Fatal error: Class 'google\cloud\storage\StorageClient' not found in C:\Users..

Is there a component to install for cloud storage?

Thanks

2
Hi George, Thank you for your advice. ACtually even after deploying project in to my google project I get the same issue. That's why I thought it's something to do with gcloud app engine setting. Because according to my understanding in google app engine all the libraries are available by default. Aren't it? This is my project and I get the same error. assignment2-s3682248.appspot.com Chears SamSam

2 Answers

0
votes

Thank you for your advice. ACtually even after deploying project in to my google project I get the same issue. That's why I thought it's something to do with gcloud app engine setting. Because according to my understanding in google app engine all the libraries are available by default. Aren't it? This is my project and I get the same error. https://assignment2-s3682248.appspot.com/ https://rb.tc/4YY3B#https://assignment2-s3682248.appspot.com/

Chears Sam

On Fri, Sep 27, 2019 at 4:27 AM 'George (Cloud Platform Support)' via Google App Engine wrote:

As PHP scripts run relative to the current path, not to the path of script itself, you can use DIR to change this behavior, so that include refers to the script's own path, as a result.

StorageClient not found error is likely due to the absence of Cloud Storage Client Libraries https://cloud.google.com/storage/docs/reference/libraries, which you'll have to install.

This discussion group is oriented more towards general opinions, trends, and issues of general nature touching the app engine. For coding in PHP, and program architecture, as well as importing Cloud Storage Client Libraries, you may be better served in dedicated forums such as stackoverflow, where experienced programmers are within reach and ready to help.

0
votes

I'm really not sure if your question has already been answered (since I see you posted an answer that a GCP support agent gave you) but you didn't accept it.

If you are new with App Engine/PHP I would recommend to follow the documentation's quickstart to get a simple project up and running and then you can start modifying it accordingly to your requirements.

From the questions I could find on your post, how to use the "autoload" of composer with DIR and how to use the Cloud Storage lib in your app. I recommend to carefully read the documentation I have referenced (the three are from the same documentation but on specific parts) which describes the step by step on how to build your application.