lando / platformsh

The Official Platform.sh Lando Plugin
https://docs.lando.dev/platformsh
GNU General Public License v3.0
6 stars 4 forks source link

Can't get xdebug working with platformsh recipe and PHPStorm #111

Closed aimfeld closed 2 years ago

aimfeld commented 3 years ago

I have tried quite a bit and read various sources, but I just can't figure out how to get xdebug working with lando and the platform.sh recipe. Otherwise, my local site runs fine. Any help is greatly appreciated. My OS is Windows 10.

Here are my settings:

.lando.yml

name: surveylab-blueprint
recipe: platformsh
config:
  id: bftge3smv4qgi
  xdebug: true
env_file:
  - .env
excludes:
  - .idea
  - .platform
  - .yarn
  - node_modules
  - vendor
  - "!vendor/cloud-solutions"

.platform.app.yaml

runtime:
  extensions:
    - redis
    - xdebug
  xdebug:
    idekey: PHPSTORM  # See https://docs.platform.sh/languages/php/xdebug.html

...

php.ini in /app

; Xdebug
xdebug.remote_connect_back = 1
xdebug.idekey = "PHPSTORM"

...

PHP Settings: image

CLI Interpreter: image

Debug Settings: image

DBGp Proxy: image

PHP Info: image image image image

pirog commented 3 years ago

@labboy0276 you've gotten this to work right?

labboy0276 commented 3 years ago

@pirog what @aimfeld has there seems correct. I will take some time in this week and see if I can replicate and report back with a fix if needed.

pirog commented 3 years ago

@labboy0276 sounds good. It might just be a matter of documenting it in our platform.sh docs

Adstokoe19 commented 3 years ago

@aimfeld if you are using Xdebug 3, you need to update your settings as per https://xdebug.org/docs/upgrade_guide

pirog commented 3 years ago

Platform.sh provides its own images so the xdebug configuration is likely different eg you would set it up according to their docs

On Mon, Dec 7, 2020 at 12:20 PM Andrew Stokoe notifications@github.com wrote:

@aimfeld https://github.com/aimfeld if you are using Xdebug 3, you need to update your settings as per https://xdebug.org/docs/upgrade_guide for example, in your lando.yml file, xdebug: true is now xdebug: debug.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lando/lando/issues/2733#issuecomment-740059204, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFOFUERHIMFEAQTPAVH6M3STUFF7ANCNFSM4UQLKCNQ .

labboy0276 commented 3 years ago

@aimfeld After looking at one of my sites, you will need to change your files to the following:

.lando.yml

name: surveylab-blueprint
recipe: platformsh
config:
  id: bftge3smv4qgi
  variables:
    app:
      php:
        xdebug.remote_connect_back: 1
env_file:
  - .env
excludes:
  - .idea
  - .platform
  - .yarn
  - node_modules
  - vendor
  - "!vendor/cloud-solutions"

.platform.app.yaml

runtime:
  extensions:
    - redis
    - xdebug

Remove the IDEKEY from PHPStorm as well. Also, delete your php.ini. The p.sh documents aren't exactly on par with how things work in lando. I will update the docs here: https://docs.lando.dev/config/platformsh.html#xdebug @pirog

If you are still having issue @aimfeld , I suggest getting the chrome xdebug browser extension and turning that on.

pirog commented 3 years ago

@labboy0276 updated the docs with your suggestion

aimfeld commented 3 years ago

@labboy0276 Thanks for the quick help! In the meantime, I set up a whole new OS (Linux Mint) with a fresh install of PHPStorm, Docker, and Lando.

Now I got xdebug 2.9.8 working with very few settings:

.lando.yml: No xdebug-related settings needed at all. Setting xdebug.remote_connect_back: 1 here did not work for me. It didn't show up as enabled in phpinfo either.

name: surveylab-blueprint
recipe: platformsh
config:
  id: bftge3smv4qgi
env_file:
  - .env
excludes:
...

.platform.app.yaml: removed xdebug idekey, as you suggested

runtime:
  extensions:
    - redis
    - xdebug
...

php.ini in /app: These settings are both necessary. Removing either and then lando restart will make xdebug not work.

; Xdebug
xdebug.remote_connect_back = 1
xdebug.idekey = "PHPSTORM"

...

Setting a PHP cli interpreter or DBGp Proxy was not necessary.

labboy0276 commented 3 years ago

ok @aimfeld it is odd it didnt show you for you as it worked fine on my end. I will close this out.

aimfeld commented 3 years ago

Turns out I made a mistake with the configuration, that's why xdebug.remote_connect_back: 1 in .lando.yml was not picked up. I needed to specify the correct service name instead of app