google-cloud-platformapp-engine-flexiblegoogle-cloud-debugger

How to edit php.ini in App Engine Flex to enable Google Cloud Debugger for PHP


I am following the steps on this page https://cloud.google.com/debugger/docs/setup/php?authuser=1 for the App Engine Flex.

At once, the docs asks the following:

Install the stackdriver_debugger extension from PECL:

pecl install stackdriver_debugger-alpha

If your php.ini file does not include extension=stackdriver_debugger.so after running this step, add it manually.

My app is running on App engine flex. How to access the php.ini on the App Engine Flex?

Thanks


Solution

  • If you want to access or update your files in App Engine Flexible you need to SSH to your App Engine Flex instance and edit the file/s, follow the steps below:

    1. First, you need to enable the debug mode in the Cloud Console before you can SSH, you can use gcloud command:
    gcloud app --project [PROJECT-ID] instances enable-debug
    
    1. Go to App Engine > Instances, click SSH in the far right of the row containing the instance you want to access.
    2. In the terminal window, to see the container-name and list the containers running in the instance:
    sudo docker ps
    
    1. To enter the conitainer:
    sudo docker exec -it [CONTAINER-NAME] /bin/bash
    
    1. To show your files, execute ls then to edit your files execute the ff:

    A. I'm using nano to edit my files. At first there is no package cache in the image, you need to run the ff before you can install the nano and use it:

    apt-get update
    

    B. Now, install the nano

    apt-get install nano 
    
    1. Edit your files, example:
    nano php.ini
    
    1. Then save Ctrl+x,Y and hit Enter. When you are finished debugging or updating the file/s, enter exit to exit the container, then exit again to exit the SSH session.

    2. Lastly, disable debugging for your instance to allow it to resume normal operation.

    gcloud app --project [PROJECT-ID] instances disable-debug