Laravel’s Tinker quits immediately on PHP 7.3 & Mac

Oh Dear! monitors your entire site, not just the homepage. We crawl and search for broken pages and mixed content, send alerts when your site is down and notify you on expiring SSL certificates.

Start your free 10 day trial! »

Image of Mattias Geniar

Mattias Geniar, October 14, 2019

Follow me on Twitter as @mattiasgeniar

I had a weird issue with Laravel’s Tinker artisan command. Every time I would load it up and type a command, it would immediately quit.

$ php artisan tinker
Psy Shell v0.9.9 (PHP 7.3.8 — cli) by Justin Hileman
>>> Str::plural('url', 1);

$ 

It would just jump straight back my terminal prompt.

The fix appears to be to add a custom config that instructs PsySH – on which Tinker is built – to not use PHP’s pcntl extension for process control.

$ cat ~/.config/psysh/config.php
<?php
return [
  'usePcntl' => false,
];

That one did the tricky for me.

$ php artisan tinker
Psy Shell v0.9.9 (PHP 7.3.8 — cli) by Justin Hileman
>>> Str::plural('url', 1);
=> "url"
>>> Str::plural('url', 2);
=> "urls"

Hope this saves you some headaches!

Will you help me share this post?

It would mean a lot to me if you could help share this post on social media. 🤗