Skip to content

Troubleshooting

Justin Hileman edited this page Feb 21, 2022 · 10 revisions

πŸ› Troubleshooting

Forking

When possible, PsySH uses forking extensively to recover from fatal runtime errors. This requires the PCNTL extension, which is usually available on most Linux and macOS flavors of PHP.

There have been reports of PHP modules that don't play well with forking. For example, cURL with PKCS #11 crypto and PCRE regex with JIT.

If you run into issues with these or other extensions, you can temporarily disable forking in PsySH via the 'usePcntl' => false configuration option, but you should also file a bug with the offending module to get it resolved.

The mysqli library can lose connections when forking (see #667). Disabling usePcntl should resolve any issues with the mysqli library.

There also seems to be a bit of weirdness with process resources across forks (for example, see #441). If you often use proc_open, disabling forking should make it work as expected.

Code reloading

In PHP 5.x, install the runkit extension to get runtime code reloading in PsySH. For early versions of PHP 7.x, you can use runkit7 before version 4.0.0a1 where the runkit_import function was removed.

Unfortunately, due to limitations in PHP, PsySH does not support code reloading other versions of PHP. To pick up changes to existing code, you'll need to restart PsySH. See more info than you ever wanted to know here.

Debugging a web request

PsySH doesn't (yet?) support debugging Apache or Nginx requests. In order to debug a web request, you need to serve your app using the CLI SAPI built-in web server.

If you're feeling ambitious, open a pull request for providing a web debugging UI or a remote PsySH debugger πŸ™‚

PsySH unexpectedly quit

In Windows (MSYS2) PHP, it may be necessary to increase max_execution_time to prevent PsySH from exiting after 30 seconds (see this comment for more).

Unicode is gibberish on Windows

Yeah πŸ˜•

See #299 for some things to try.