googlecloudplatform / php-docs-samples Goto Github PK
View Code? Open in Web Editor NEWA collection of samples that demonstrate how to call Google Cloud services from PHP.
Home Page: http://cloud.google.com/php
License: Apache License 2.0
A collection of samples that demonstrate how to call Google Cloud services from PHP.
Home Page: http://cloud.google.com/php
License: Apache License 2.0
We need some samples for google-cloud-php translate API (see here).
This sample should display the followng:
This should be added to translate/api
and follow a similar format to the code in language/api
Wrong composer file...
Can we update that?
There was 1 error:
1) utilTest::testListDatasets
Object of class Google_Service_Bigquery_DatasetListDatasets could not be converted to string
<https://jenkins.on2flixcloud.tv/job/php-docs-samples/ws/bigquery/api/test/utilTest.php>:124
FAILURES!
If there any way to enable modules on appengine flexible.
I'm currently working with a laravel application.
All the READMEs should link to the docs for the APIs they reference. That way if someone ends on on the README they can gain the greater context of the documentation, instead of just the isolated sample.
After installing and while running vendor/bin/wp server I am getting this error on MacOSX in standard mode:
Class 'Memcache' not found in my-wordpress-project/wordpress/wp-content/object-cache.php on line 425
The file object-cache.php resides in multiple locations. That looks a bit weird.
It's about the last part of the README.
~/bin/drupal config:edit
[InvalidArgumentException]
There are no commands defined in the "config" namespace.
Also, the integration test on our jenkins fails with:
+ /workspace/php-docs-samples/managed_vms/drupal8/tests/drupal cache:rebuild all
[InvalidArgumentException]
There are no commands defined in the "cache" namespace.
Do I miss something?
Hi everyone!
I just try to install a bare WordPress and followed the README.md
steps.
The CloudSQL instance is running and I can access it locally via the cloudsql-proxy
.
After fixing the app.yaml
to use the flexible AppEngine setting to
env: flex
and wp-config.php
/** Production environment */
define('DB_HOST', ':/cloudsql/$PROJECT_ID:us-east1:$DBNAME');
/** The name of the database for WordPress */
define('DB_NAME', '$DBNAME');
/** MySQL database username */
define('DB_USER', '$DBUSERNAME');
/** MySQL database password */
//define('DB_PASSWORD', '$DBPASSWORD');
deployment works but opening any page in Wordpress ends (after a long time) in the following error:
Warning: mysqli_real_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /app/wordpress/wp-includes/wp-db.php on line 1538 Warning: mysqli_real_connect(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Name or service not known in /app/wordpress/wp-includes/wp-db.php on line 1538 Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /app/wordpress/wp-includes/wp-db.php on line 1568 Notice: mysql_connect(): SQL safe mode in effect - ignoring host/user/password information in /app/wordpress/wp-includes/wp-db.php on line 1568 Warning: mysql_connect(): No such file or directory in /app/wordpress/wp-includes/wp-db.php on line 1568
Error establishing a database connection
Interestingly, using mysql-client
on the command-line to connect via the socket works.
mysql -S /cloudsql/$PROJECTID\:us-east1\:$DBNAME -u $DBUSER -p$DBPASSWORD
to use gcloud app
under the cover
This one needs CORS headers.
See sample implementation here:
https://github.com/GoogleCloudPlatform/golang-samples/blob/master/docs/managed_vms/endpoints/app.go
and copy the new swagger file:
https://github.com/GoogleCloudPlatform/golang-samples/blob/master/docs/managed_vms/endpoints/swagger.yaml
Hi, when i execute gcloud app deploy, i got error
chown: cannot access 'appwordpress': No such file or directory
We have updated the library to be at version 0.20.0: https://github.com/GoogleCloudPlatform/google-cloud-php/releases
We should update all our samples to test against the latest library.
both the compute and the storage samples need tests. We need to find out how best to test these. I suggest using the WebTestCase base class for silex.
Memcache and PHP 5.5 should be added as prerequisites or mentioned in the README since they are need for running WordPress Standard Environment locally.
EDIT: I currently have not looked into documenting the prerequisites for the Flexible Environment.
createCommentRequest
should use autoInsertId
instead of creating a unique key before insert. This will constitute 1 request instead of 2, and is the preferred method
Below are the common errors I keep experiencing when trying to setup Wordpress on GoogleCloud.
Port Changing
It is very difficult to change from localhost:8080 to localhost:8081, any ideas showing how to do that would be greatful especially when running multiple, wordpress sites.
How to change the path
When installation is complete, Wordpress asks, to change the PHP Executable path, any ideas showing how to do this would be greatful.
After setting up the site, the site keeps reloading and no error shows, whats going on.
Nothing is showing up in the error logs pages.
When setting up, the vendor folder is not created and the site can't run without the vendor folder.
@tmatsuo @bshaffer
https://github.com/GoogleCloudPlatform/appengine-php-wordpress-starter-project, from your webpage, use that one as the official one, since there are now multiple ones. This will avoid the confusion.
OpenSSL
MAMP PRO
Memcache
His
I am able to convert audio file to text, can any one help me how to use gprc for live streaming voice conversation
there is a line where a response is json decoded and then immediately decoded. This is sloppy and should be investigated.
I need the physical path of the file to edit on my local machine, you can recover the path of the file with PHP?
This will open a door for implementing automatic updates and deploy infrastructure.
This can be done by running the following bash command:
find . -name composer.lock -not -path "*/vendor/*" \
-exec sh -c 'pushd "${0%/*}" && composer update && popd' {} \;
I have a wordpress setup running in the Standard Environment.
Execution locally with CloudSQL also works.
But performing Plugin maintenance via wp
always fails:
# vendor/bin/wp plugins list --path=wordpress
PHP Warning: require_once(google/appengine/api/urlfetch_service_pb.php): failed to open stream: No such file or directory in /Users/Sebastian.Just/development/workspaces/gcp/wordpress2/wordpress/wp-content/plugins/google-app-engine/modules/urlfetch.php on line 72
Warning: require_once(google/appengine/api/urlfetch_service_pb.php): failed to open stream: No such file or directory in /Users/Sebastian.Just/development/workspaces/gcp/wordpress2/wordpress/wp-content/plugins/google-app-engine/modules/urlfetch.php on line 72
PHP Fatal error: require_once(): Failed opening required 'google/appengine/api/urlfetch_service_pb.php' (include_path='.:') in /Users/Sebastian.Just/development/workspaces/gcp/wordpress2/wordpress/wp-content/plugins/google-app-engine/modules/urlfetch.php on line 72
Fatal error: require_once(): Failed opening required 'google/appengine/api/urlfetch_service_pb.php' (include_path='.:') in /Users/Sebastian.Just/development/workspaces/gcp/wordpress2/wordpress/wp-content/plugins/google-app-engine/modules/urlfetch.php on line 72
And it's true - those files really don't exist starting with google/appengine/
- but I'm unsure how the required_once
even makes up those file names
Can I use the local server to update/install plugins or will this screw up some file paths in the Wordpress database?
I successfully upload a file to my bucket in GCStorage.
The question is that I do not see how can I set the max-age parameter in the metadata using the PHP API.
Here is the code I use:
$file = fopen($_SERVER['DOCUMENT_ROOT']."/uploads/example_50.jpg", 'r');
$bucket = $storage->bucket("my_bucket");
$object = $bucket->upload($file, [
'name' => "example_50.jpg"
]);
$object = $bucket->object("example_50.jpg");
$object->update(['acl' => []], ['predefinedAcl' => 'PUBLICREAD', 'max-age' => 36000]);
As you can see, I have tried it but no success.
Any idea?
Upon a successful app build and deployment to App Engine, once I decided to promote the version with Wordpress installed (omitted the --promote --stop-previous-version
flags) I am receiving a 403 error at my project url, both the .appspot.com
domain and custom domain. I tried multiple urls such as:
thinking something functioning may be at one of those options.
I had checked the logs for anything obscene, but could not see anything causing any issues.
I would really appreciate any help to figure my problem out. Let me know if there's any info I can provide that would help.
The flat-file PHP style samples are good in the fact they are simple, but we may be able to have something even more elegant if we incorporate silex and then have each sample be just a callback function for the sample. Then the samples could all be run at once while still maintaining readability. See the python-docs-samples for reference.
However, it still may be cleaner to keep them as-is, so we'll just have to see as we create new samples what the best method is.
please replace /memcache/ with /memcached/ in README.md
Store and retrieve values from the cache.
``
$ curl http://{YOUR_PROJECT_ID}.appspot.com/memcached/a
$ curl http://{YOUR_PROJECT_ID}.appspot.com/memcached/a -T hello.txt
$ curl http://{YOUR_PROJECT_ID}.appspot.com/memcached/a
The generated app.yaml looks like this:
runtime: custom
vm: true
beta_settings:
cloud_sql_instances: PROJECT_NAME:us-central1:wp
runtime_config:
document_root: wordpress
Error
Beginning deployment...
ERROR: (gcloud.preview.app.deploy) Unknown runtime_config entry : document_root.
I realized today that the following Error Reporting sample:
$msg = array(
'message' => $e->getMessage(),
'serviceContext' => array('service' => 'myapp'),
// ... add more metadata
);
Does not produce log messages that are processed by Stackdriver Error Reporting.
While waiting for the Stackdriver error parser to be updated, we must update our code sample to log errors in the appropriate format:
This code produces a payload that is correctly processed, I tested it and another person confirmed:
$msg = array(
'message' => sprintf("PHP Notice: %s", (string)$e),
'serviceContext' => array('service' => 'myapp'),
// ... add more metadata
);
I wanted to submit a PR, but realize that there are tests associated. Please update the sample as soon as possible to fix the Stackdriver Error Reporting compute engine instructions: https://cloud.google.com/error-reporting/docs/setup/compute-engine
I'm interesting on using the image tools but so far I've only seen documentation on the standard environment.
When I got the instance prompted I have the following error.
Please select the region of your Cloud SQL instance (defaults to us-central1)
[0] us-central1
[1] us-east1
[2] europe-west1
[3] asia-east1
> 3
Using a db_region: asia-east1
Downloading the WordPress archive...
Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed in /Users/xxx/php-docs-samples/appengine/wordpress/src/Project.php on line 47
Warning: file_get_contents(): Failed to enable crypto in /Users/xxx/php-docs-samples/appengine/wordpress/src/Project.php on line 47
Warning: file_get_contents(https://wordpress.org/latest.tar.gz): failed to open stream: operation failed in /Users/xxx/php-docs-samples/appengine/wordpress/src/Project.php on line 47
**[UnexpectedValueException]
internal corruption of phar "/private/var/folders/r_/_b85hgnd7lx155j35n8hbd
mm0000gn/T/latest.tar.gz" (truncated entry)**
I have OpenSSL 1.0.2j and installed it by MacPorts.
I have PHP 5.6.24.
Your help would be appreciated.
@tmatsuo @jmdobry
The media file was saved localhost:8080/_ah/gcs/app_default_bucket/filename
It worked during the development time.
But when I continuously developed next day, the file in the Media library has been missing.
I followed the google documentation to solve the above issue.
So, I have installed the client library using $ composer require google/cloud
/PATH/TO/MY_PROJECT/ directory where app.yaml is being.
And, I have this script linked from Google. (php-docs-samples/storage/quickstart/quickstart.php)
I don't know how to run this client libarary with my WordPress project.
The help would be appreciated.
When running the WordPress code generation, It does not let you populate the CloudSQL connection name with the region. I have created a fork with a rough implantation of this feature.
Would there be an interest to add the functionality to choose between using 1st or 2nd generation CloudSQL instance?
Current example behavior:
:/cloudsql/{{project_id}}:{{db_instance}}
Expected example behavior:
:/cloudsql/{{project_id}}:{{db_region}}:{{db_instance}}
When running phpunit:
PHP Strict Standards: Non-static method Google\Cloud\Test\DeployTest::downloadPhpmyadmin()
should not be called statically in
php-docs-samples/appengine/standard/phpmyadmin/tests/DeployTest.php on line 114
Strict Standards: Non-static method Google\Cloud\Test\DeployTest::downloadPhpmyadmin()
should not be called statically in
php-docs-samples/appengine/standard/phpmyadmin/tests/DeployTest.php on line 114
Some directories still have runtime: custom
, but we should use runtime: php
if possible.
We need some samples for google-cloud-php vision API (see here).
This sample should display the following:
This should be added to vision/api
and follow a similar format to the code in language/api
, speech/api
, etc. This should be modeled after the vision quickstart
Is it possible to specify the default php version for my application?
It recently changed to 7.1 in php-docker and I getting some incompatibilities in my application.
If I have one instance created and want to create multiple wordpress sites, do I have to create each instance for each project?
Can I run more than one database on a single instance?
What is the benefit and disadvantage of either?
hello everyone!
I would like to test a WordPress application (Flexible Environment) locally with local database, not Cloud SQL.
I have scripted
$ php -S localhost:8080 wordpress
It didn't work and got the following errors:
`Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
Fatal error: Unknown: Failed opening required 'wordpress' (include_path='.:') in Unknown on line 0`
I think the problem is in my app.yaml.
# application: xxxx
# version: 2017-01-10-test
service: default
runtime: php
env: flex
beta_settings:
cloud_sql_instances: "xxxx:asia-northeast1:xxxxx"
runtime_config:
document_root: wordpress
env_variables:
WHITELIST_FUNCTIONS: escapeshellarg,escapeshellcmd,exec,pclose,popen,shell_exec,phpversion,php_uname
Please help!
Hi,
I'm following the tutorial about how to install the API and once cloned the repository, I try to get access cd php-docs-samples/storage/cli and not found.
Even if you try the 4th step for installing dependences, composer.phar is not found in any directory.
What's missing in my procedure?
Strangely, there was one time that I followed your Wordpress instructions and everything worked fine. That was with my old GCP account.
My client created their own account and I've tried to duplicate the process, but can't login to MySQL through the proxy. (See errors below.)
Started up the proxy.
Dougs-Mac:secondmarketcapital-website doug$ ../cloud_sql_proxy -dir /tmp/cloudsql -instances=secondmarketcapital-website:us-central1:wp=tcp:3306 -credential_file=secondmarketcapital-website-169172622c01.json &
[1] 27461
Dougs-Mac:secondmarketcapital-website doug$ 2016/08/14 22:36:18 Listening on 127.0.0.1:3306 for secondmarketcapital-website:us-central1:wp
2016/08/14 22:36:18 Ready for new connections
Tried to connect.
Dougs-Mac:secondmarketcapital-website doug$ /usr/local/mysql/bin/mysql -h 127.0.0.1 -u root -p
Enter password:
2016/08/14 22:59:19 New connection for "secondmarketcapital-website:us-central1:wp"
2016/08/14 22:59:19 couldn't connect to "secondmarketcapital-website:us-central1:wp": ensure that the account has access to "secondmarketcapital-website:us-central1:wp" (and make sure there's no typo in that name). Error during createEphemeral for secondmarketcapital-website:us-central1:wp: googleapi: Error 403: The client is not authorized to make this request., notAuthorized
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0
Something makes me think I've not don't the service account correctly. Under "select a role" I picked "Project/Service Account Actor", but I'm not sure that was correct.
Expand the README for the language samples
https://github.com/GoogleCloudPlatform/php-docs-samples/tree/master/language/api
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.