1

I am working on a PHP Project in Google Cloud. I am almost done with my project but I have to execute a command using my PHP script in Google Cloud.

Let suppose I want to view files

<?php exec('ls') ?>

Is there is any way to run commands in Google Cloud ??

kkpoon
  • 1,939
  • 13
  • 23
  • Which app engine are you using, Standard or Flexible? If you are using App Engine Standard Environment, you cannot make system call. https://cloud.google.com/appengine/docs/standard/php/runtime `An App Engine application cannot: make other kinds of system calls.` – kkpoon Jul 18 '18 at 01:46
  • but i am using flex environment still i'm not able to perform system call...or not able to execute any command using php exec function.. – Rohit Joshi Jul 18 '18 at 07:04

1 Answers1

2

According the document

Disabled functions

The following functions are disabled with the disable_functions directive in php.ini:

  • exec

the exec is disabled by default if you use gcp provided php runtime, could add a php.ini file to change this behaviour.

If you need any of the above functions, add a php.ini file in the root of your application and change the disable_functions directive. Alternatively, set whitelist_functions in the runtime_config section in app.yaml to a comma-delimited list of functions to allow.

kkpoon
  • 1,939
  • 13
  • 23