PHP Artisan Tinker crashing from any command
Asked Answered
P

2

35

I haven't had this problem before, but my php artisan tinker crashes from issuing any command - and leaves no logs whatsoever on what is causing the crash.

project4 $ php artisan tinker
Psy Shell v0.9.9 (PHP 7.3.0 — cli) by Justin Hileman
>>> use \App\Jobs\testJob;
project4 $

or even the simplest command:

project4 $ php artisan tinker
Psy Shell v0.9.9 (PHP 7.3.0 — cli) by Justin Hileman
>>> print("Hello World!");
project4 $

I almost wonder if it isn't connecting to PHP correctly, but I can't find any logs anywhere. Laravel has no trace of the commands. I ran brew update, but no difference. For the record, all of my projects are affected. I can't tinker on any of my projects. Help!

I did recently upgrade to PHP 7.3.0, which is working fine in every other area. Hmm...

Premises answered 14/12, 2018 at 3:25 Comment(6)
Have you tried to run composer dump-autoload?Wrap
Or blow away vendor entirely, then composer install to restore it.Karaite
@P.Ellul Tried it, didn't make any difference.Premises
@Karaite Just tried... nothing.Premises
For clarity, artisan is a tool which comes with Laravel, and is not related to composer.Premises
Open your artisan file in your project root, it requires /vendor/autoload.php. These vendors are provided by composer.Wrap
C
108

If you don't have the pcntl extension installed, try creating a config file at ~/.config/psysh/config.php if not already there:

<?php
return [
  'usePcntl' => false,
]; 

Source: https://github.com/bobthecow/psysh/issues/540#issuecomment-446480753

Canales answered 18/12, 2018 at 4:54 Comment(3)
Work fo me on a fresh Mojave install!Accredit
This was completely and utterly my issue. Just upgraded to php 7.3 on mojave. Thanks!Lilywhite
I've hit the same issue and the fix worked with a Ubuntu docker container and php 7.4.16. Possibly I have some php extension missing.Keniakenilworth
F
9

This happens on Mojave when you upgrade/install PHP 7.3 using homebrew, (It's a problem with PsySh (used by Tinker) and Homebrew's PHP 7.3.0 build.)

Simple solution is, In your php.ini set

pcre.jit=0


If you don't know which ini file is used, you can run php --ini to find it,

# /usr/local/etc/php/7.3/php.ini
- ;pcre.jit=1
+ pcre.jit=0
Freehand answered 11/5, 2019 at 1:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.