Jump to content

Using DDEV for local ProcessWire development (tips & tricks)


bernhard

Recommended Posts

10 hours ago, nurkka said:

does anybody use PHPStorm within WSL2 and could share some insights

I use it with great speed (not using Mutagen, as it is not needed in WSL2). I also work with VScode (with WSL plugin from Microsoft) and it also works great.

  • Thanks 1
Link to comment
Share on other sites

7 hours ago, cst989 said:

One thing I've found is that most environments will show php warnings when using

$config->debug = true

but ddev will not. Does anyone worry/do anything about this?

This hasn't been my experience. DDEV shows both warnings and fatal errors. I haven't had to do anything special. What's your environment?

  • Like 1
Link to comment
Share on other sites

  • 4 weeks later...
On 11/6/2024 at 9:41 PM, kongondo said:

Anyone got xdebug + WSL2 + DDEV + VScode working please? I have read the tut in the DDEV docs but it is not working for me.

  1. In VSCode the Xdebug session starts. On the website Xdebug doesn't kick in. 
  2. After a while, VSCode breakpoints turn transparent and hovering over them says 'invalid breakpoint' or something like that.
  3. I did attempt all the WSL-related troubleshooting in the DDEV docs, e.g. the telnet connection. Was hoping for a question here.
  4. After a while VSCode says port 9003 closed.
  5. Sometimes I see notifications from ProcessWire (e.g. headers already sent) in the debug output.
  6. I am not sure whether and how to append the port number 9003 to the ddev url. E.g. mysite.ddev.site:9003. If I do this, the website hangs (chrome website cannot be reached).

Any ideas?

Thanks!

Good day, @kongondo! Have you managed to get it to work?

P.S. I have managed to make it work both for web and cli. The only thing that I still cannot figure out is how to launch a specific php file (see an example without ddev below). Still can't find out how to start it not with php but with ddev exec php.

        {
            "name": "Launch test.php",
            "type": "php",
            "request": "launch",
            "program": "${workspaceFolder}/test.php",
            "cwd": "${workspaceFolder}",
            "port": 0,
            "runtimeArgs": [
                "-dxdebug.start_with_request=yes"
            ],
            "env": {
                "XDEBUG_MODE": "debug,develop",
                "XDEBUG_CONFIG": "client_port=${port}"
            }
        }

I have tries adding "runtimeExecutable": "ddev exec php", but it didn't work for some reason:

Error: spawn ddev exec php ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:285:19)
    at onErrorNT (node:internal/child_process:483:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn ddev exec php',
  path: 'ddev exec php',
  spawnargs: [
    '-dxdebug.start_with_request=yes',
    '...',
    '...'
  ]
}

 

Link to comment
Share on other sites

Have you ever realised that DDEV only works when you are connected to the internet? No? Then all fine 😉 

If you did, I have good news for you! DDEV does NOT require a working internet connection! You can, of course, use it for local development without being online - for example on a plane.

The only thing you need to know is that if you started the project via "ddev start" while being connected to the internet and then you go offline, then your browser will not find your project any more. All you have to do to solve that is to run a "ddev restart" 🙂 

The reason for this is explained here: https://ddev.com/blog/ddev-name-resolution-wildcards/

@gebeer

  • Like 2
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...