0

I am trying to create a task for the default queue. for this, I wrote following codes, but it is not working.

//including 
use google\appengine\api\taskqueue\PushTask; 
use google\appengine\api\taskqueue\PushQueue;

//Initialising,
        $task = new PushTask('/worker', [$values], ['header' => "Host: https://-myserviceurl"]);       
        $queue = new PushQueue('default');
        $queue->addTasks([$task]);

My question is,

  1. Can we create tasks from the flexible environment if the PHP runtime is72?
  2. If the above method won't help me to create tasks, then how to create one while my all services in the flexible environment?

1 Answers1

0

You can use the Google Cloud Client library for PHP, which supports PHP 7.2, and will work in the Flexible App Engine environment.

You are looking into using the Cloud Tasks API, which does the same as the appengine task queues, but in a separate API.

You can check this documentation for the installation of these library and a sample code, and this documentation as a reference for the API methods and usage for the V2beta3 version of this API libraries, which is the latest, and the one I recommend you to use.

Joan Grau Noël
  • 3,084
  • 12
  • 21
  • I tried this, but getting an error" nginx: [warn] the "user" directive makes sense only if the master process runs with super-user privileges, igno red in /tmp/google-config/nginx.conf:3" – Sandra Sasi Feb 12 '19 at 05:14