phpgoogle-cloud-platformcloudgoogle-cloud-workstations

How to debug PHP application in Google Cloud Workstations


Currently I use Google Cloud Shell Editor as my chosen IDE. I like the code editor based on VS Code, and also like the persistent 5GB home directory. This allows me to install PHP on the home directory, which in turn means that I can run my app using the command php -S localhost:8080

Recently I heard about Google Cloud Workstations which provides multi-IDE support, including a version of VS Code called "Code-OSS". I would like to start using the Cloud Workstations as my IDE, but the one thing holding me back is PHP. I don't know how to debug a PHP application using Google Cloud Workstations which run in the browser.

How can I run my PHP applications in Google Cloud Workstations which run in the browser?


Solution

  • If you're familiar with VS Code, the look and feel is very similar. I've managed to run php -S localhost:8080 using Google Workstations by updating and upgrading my packages first:

    sudo apt-get update
    sudo apt-get upgrade
    

    Then I install PHP afterwards:

    sudo apt-get install php
    

    Right now I'm using the latest PHP version (PHO 7.4.30) but you can use your preferred version using this link as your reference.

    Let me know if this worked out for you.