psysh

PHP shell / psysh: starting directory?


How to change the directory psysh is starting from? It seems to be starting from /var/www/html because any file I try to import is referenced from that path... I'd like to start the shell in my app directory.

Psy Shell v0.10.4 (PHP 7.3.23 — cli) by Justin Hileman

>>> require __DIR__ . '/vendor/autoload.php';
PHP Fatal error:  Failed opening required '/var/www/html/vendor/autoload.php' in Psy Shell code on line 1
>>>

Solution

  • The solution was to change the directory in the config file of psysh:

    chdir('/YOUR_FOLDER/'); in psysh.config.php