5

Laravel’s Tinker quits immediately on PHP 7.3 & Mac

 2 years ago
source link: https://ma.ttias.be/laravels-tinker-quits-immediately-on-php-7-3-mac/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Laravel’s Tinker quits immediately on PHP 7.3 & Mac

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!


Want to subscribe to the cron.weekly newsletter?

I write a weekly-ish newsletter on Linux, open source & webdevelopment called cron.weekly.

It features the latest news, guides & tutorials and new open source projects. You can sign up via email below.

No spam. Just some good, practical Linux & open source content.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK