@classmethod
  def _check_gae_extension(cls, php_executable_path, gae_extension_path, env):
    if not os.path.exists(gae_extension_path):
      raise _PHPBinaryError('The path specified with the '
                            '--php_gae_extension_path flag (%s) does not '
                            'exist.' % gae_extension_path)

    # The GAE extension requires APPLICATION_ROOT to be set.
    env['APPLICATION_ROOT'] = os.getcwd()

    args = [php_executable_path, '-m',
            '-d', 'extension="%s"' % os.path.basename(gae_extension_path),
            '-d', 'extension_dir="%s"' % os.path.dirname(gae_extension_path)]

    ext_process = safe_subprocess.start_process(args,
                                                stdout=subprocess.PIPE,
                                                stderr=subprocess.PIPE,
                                                env=env)
    ext_stdout, ext_stderr = ext_process.communicate()
    if ext_process.returncode:
      raise _PHPEnvironmentError('"%s -m" returned an error [%d]\n%s%s' % (
          php_executable_path,
          ext_process.returncode,
          ext_stderr,
          ext_stdout))

    if GAE_EXTENSION_NAME not in ext_stdout:
      raise _PHPEnvironmentError('Unable to load GAE runtime module at %s' %
                                 gae_extension_path)
Check if GAE extension can be loaded.
dataset/ETHPy150Open GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/tools/devappserver2/php_runtime.py/PHPRuntimeInstanceFactory._check_gae_extension