Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

racl101's avatar

Does anyone know if the psysh REPL runs in any situation other than Laravel Tinker? I'm trying to troubleshoot performance issues with server and this process is shown running and using a lot of memory.

For example, would Laravel invoke psysh for job queues? Given that it's supposed to be an interactive tool I can't think of why this program would be running. Also, I've tried to see if there are any Tmux sessions that were using it but none are open.

Yet, when I run htop command I can still see the process running .

0 likes
2 replies
LaryAI's avatar
Level 58

Certainly! Here’s a detailed answer for your Laracasts forum question:


Solution:

psysh is the underlying REPL (Read-Eval-Print Loop) used by Laravel Tinker, which is an interactive shell for Laravel. By default, psysh is only invoked when you explicitly run Tinker via the command line:

php artisan tinker

Laravel does not invoke psysh for job queues, scheduled tasks, HTTP requests, or any other background processes. It is strictly an interactive developer tool.

Why Might psysh Be Running?

If you see a psysh process running and using a lot of memory, here are a few possibilities:

  1. A Tinker Session Was Started and Left Open:
    If someone started a Tinker session (possibly in a detached terminal or background process) and never exited, the psysh process would remain running.

  2. Automated Scripts or Debugging:
    Rarely, someone might automate or script Tinker sessions for debugging, but this is not common or recommended.

  3. Misconfigured Supervisor or Process Manager:
    If you use a process manager (like Supervisor) and accidentally configured it to run php artisan tinker, it would keep psysh running.

  4. Web-based Tinker Packages:
    Some packages (like spatie/laravel-web-tinker) allow running Tinker via the browser. If left open, these can spawn psysh processes.

How to Troubleshoot

  • Check Who Started the Process:
    Use ps aux | grep psysh to see the user and command line that started the process.
  • Check Process Tree:
    Use pstree -p or ps -ef --forest to see the parent process. This can help you track down what started psysh.
  • Check Supervisor/PM2/Other Managers:
    Review your process manager configs to ensure you’re not accidentally running Tinker.
  • Check for Web Tinker Packages:
    If you have a web-based Tinker package installed, ensure no one is using it or leaving sessions open.

Stopping the Process

If you determine the process is not needed, you can safely kill it:

kill <pid>

Replace <pid> with the process ID of the psysh process.


Summary:
Laravel only invokes psysh when you run Tinker. If you see it running otherwise, it’s likely due to an abandoned session, misconfiguration, or a web-based Tinker package. Investigate the process origin and stop it if unnecessary.

Snapey's avatar

I logged into one of my servers this week just to check the performance. Like you, htop showed one cpu pegged at 100%

The process name was psysh. I couldn't remember leaving it running, but as it had been running for over a month, that was going to be unlikely.

I noted the Pid, and killed it.

Reminder to self, check the graphs for my vps boxes everyweek.

Please or to participate in this conversation.