-
Notifications
You must be signed in to change notification settings - Fork 700
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot instantiate abstract class ValetDriver #915
Comments
Is this error appearing when loading a site served by Valet? Or is it by running a valet command from the command-line? What PHP version did you upgrade from? What's the output of the following? sw_vers
valet --version
cat ~/.config/valet/config.json
cat ~/.composer/composer.json
ls -al /etc/sudoers.d/
brew config
brew services list
brew list --versions | grep -E '(php|nginx|dnsmasq|mariadb|mysql|mailhog|openssl)(@\d\..*)?\s'
php -v
which -a php
brew info nginx
brew info php
sudo /usr/local/opt/php/sbin/php-fpm --test
sudo /usr/local/opt/php/sbin/php-fpm -y /usr/local/etc/php/7.4/php-fpm.conf --test
ls -al ~/Library/LaunchAgents
ls -al /Library/LaunchAgents
ls -al /Library/LaunchDaemons |
Hey @drbyte thanks for the help. To answer your questions - I upgraded from 7.1 to 7.4. I did composer global update, brew update/upgrade, valet upgrade. When it broke, I did an uninstall and clean install of everything. I have a directory parked, and I get the fatal error when trying to load a site in the browser. Pinging a .test in terminal works fine, so valet is working. I'm pretty sure its a PHP configuration/permissions/version issue. The only thing I can see is possibly an issue wiith PHP-FPM: php -v = PHP 7.4.3 (cli) (built: Feb 20 2020 12:23:37) ( NTS ) And I see in the LaunchAgents: [email protected] But, running your tests: sudo /usr/local/opt/php/sbin/php-fpm --test NOTICE: configuration file /usr/local/etc/php/7.4/php-fpm.conf test is successful sudo /usr/local/opt/php/sbin/php-fpm -y /usr/local/etc/php/7.4/php-fpm.conf --test configuration file /usr/local/etc/php/7.4/php-fpm.conf test is successful So I'm not sure. I've been using valet for years and it's always worked just by following the instructions. So, other than that, everything seems correct. I've posted the outputs below though in case I missed something: sw_vers valet --version valet/config.json PHP NGINX
brew info php
brew config |
I agree. I'd suggest deleting that 7.1 LaunchAgent |
it doesnt show up in brew services list, but the LaunchAgent keeps coming back on launch after deleting it. Looking into how to get rid of those permanently. I'm not 100% sure exactly what the issue is, suprising that I havent figured it out after like 3 hours:) php-fpm -v So that seems good now. php-fpm But that might be what it's supposed to do I think? |
Valet normally runs FPM as root. So yes it seems like you've got a non-root instance of FPM running, presumably from the wrong/old LaunchAgent. sudo deleting the launchagent file should be enough to stop it reloading on boot. Was it in the system directory? or was it under your home directory? (note the ls -al ~/Library/LaunchAgents
ls -al /Library/LaunchAgents
ls -al /Library/LaunchDaemons |
it was in ~/Library/LaunchAgents I deleted it again, restarting again. Really appreciate the help, going nuts here:) sudo tail /usr/local/var/log/php-fpm.log |
Curious about: which -a php-fpm On OSX 10.14 I'd expect that to show:
Does yours show more php-fpm binaries? What's the output of Oh, and passing |
Okay the useragent is gone, same problem. When I do valet restart, "brew services list" shows: and sudo tail /usr/local/var/log/php-fpm.log still shows: which -a php-fpm ls -al /usr/local/sbin/php* ps aux | grep fpm /usr/local/sbin/php-fpm -v |
Let's also check: |
/usr/local/opt/php/sbin/php-fpm -v |
How many
|
one - -rw-r--r-- 1 root admin 641 1 Mar 12:22 valet-fpm.conf |
Hm, that's normal. If there were multiples then the fpm logs talking about another service on the same pool would have more context. Are you still getting the ValetDriver error? |
Yah, exact same error. Cannot instantiate abstract class ValetDriver. FPM initialization is failing, valet restart can't seem to start it and using brew to start PHP doesn't work. Maybe I need to like, wipe everything and install it all again? |
Okay, maybe it's time to get destructive in order to force whatever's "not supposed to be running" to be unable to run, by deleting the configs that it is using. Do you need multiple PHP versions? Did you have custom PHP configs that you wanted to preserve? I'd suggest deleting or renaming all your PHP "X.X" version directories in the |
No Im running basic static sites and laravel apps, all out of the box. I'll delete and install again and see how it goes. |
same problem. After removing, re-installing valet, using [email protected] and restarting valet I still see this: [01-Mar-2020 12:37:37] ERROR: failed to load configuration file '/usr/local/etc/php/7.4/php-fpm.conf' brew services list |
there is no php-fpm.conf in /usr/local/etc/php/7.4 so, heh. Why doesnt this stuff just work:) Can you tell if this a brew issue or a valet issue? |
That's a different error. |
Brew was unable to link [php] |
valet use [email protected] worked, it's installing now. |
heh. Brew was unable to install [[email protected]]. |
You could try |
(Now or) Later we can run |
only thing I saw in verbose was: Warning: The post-install step did not complete successfully. Otherwise it looks like it was installed. valet use [email protected] worked. But, same fatal php error when trying to view a site... |
ERROR: failed to load configuration file '/usr/local/etc/php/7.4/php-fpm.conf' |
Were you able to run it manually? |
It should have created that as part of the post-install. |
brew postinstall php doesnt work when i run it manually either no. |
Warning: The post-install step did not complete successfully |
I'm seeing a similar issue here: #865 |
Ya, it does feel like a need to chown some things properly for homebrew to be able to do its thing. |
strange that this is an issue, never experienced problems with basic stuff like this before. So I should chown what, something in the usr/local/Homebrew directory? |
Ya, I wouldn't have expected this to "suddenly" be an issue either. An article I had bookmarked suggests this: Another article talks about more drastic reinstall of homebrew: I'd suggest the chown and the brew cleanup and brew doctor. |
If you haven't done that already, you could |
I think its a mac osx issue: Homebrew/brew#3228 |
For some maybe. It's not a global problem in my experience. |
So: sudo chown -R and I can run the postinstall process now. valet restart same issue, but seem to be making some progress. Will check through things again and maybe restart... |
Specifics are helpful here.
|
Ok, it's always a little bit different every time we take a few steps:) SO now, it seems like everything is working, but same ValetDriver issue. in the browser: Fatal error: Uncaught Error: Cannot instantiate abstract class ValetDriver in /Users/marcodeluca/.composer/vendor/laravel/valet/cli/drivers/ValetDriver.php:77 Stack trace: #0 /Users/marcodeluca/.composer/vendor/laravel/valet/server.php(111): ValetDriver::assign('/Users/marcodel...', 'screenhouse', '/') # 1 {main} thrown in /Users/marcodeluca/.composer/vendor/laravel/valet/cli/drivers/ValetDriver.php on line 77 sudo tail /usr/local/var/log/php-fpm.log seems to be working now? [01-Mar-2020 13:05:30] ERROR: FPM initialization failed brew services list |
Oh good. Much better! Back to where we started, but at least don't have rogue other PHP processes running anymore :) |
heh, oh yah after being at this for almost 5 hours I feel much better:) I would have thrown my computer out hours ago if it wasnt for your help. Any suggestions for next steps? |
Does this happen on all projects, or just Which actual Valet Driver is calling |
yah all projects. From valet's NGINX log: [error] 66166#0: *12 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught Error: Cannot instantiate abstract class ValetDriver in /Users/marcodeluca/.composer/vendor/laravel/valet/cli/drivers/ValetDriver.php:7 Im not sure about which driver, I didnt change or touch anything beyond the basic install which always worked. How do I check? |
and in case it matters, I have static HTML and laravel apps in my DEV folder (where I did valet park). Both php and html are getting the same driver error. |
Notwithstanding that you've said this is pretty vanilla without customizations, I'm inclined to suspect some sort of incompatible or damaged driver. The defaults are installed by composer in the .composer subdir. But Valet lets you customize things by putting additional drivers in your Anything custom in your |
I don't think so - ls -la ~/.config/valet ls -la ~/.config/valet/Drivers |
I'm trying to figure out how the abstract valet/cli/drivers/ValetDriver.php Lines 76 to 82 in d6558b9
It feels like one of its supported overrides contains a copy of the abstract class for some unexpected reason. |
Oh -- let's delete (or move to elsewhere) that ValetDriver.php file from there. (I bet it's a copy of the abstract class. Dunno why it's there) |
and like that it works. wtf? So that valetdriver.php wasn't supposed to be there. How it got there, and how valet has worked for the like, 2+ years I've had it if it was there since then... |
Totally baffles me too. |
Well, we sure went on a wild goose chase. But hopefully you learned a bunch too along the way, about Valet and Homebrew's inner workings. |
Well, man can't thank you enough for the help. Unfortunately the 50 messages here probably won't help many people given this is a very random problem. And I think if you break it down, three problems. So in case anyone lands here to look for issues: 1 - Mac High Sierra and beyond, Mojave, might have some permission issues with Homebrew so after updating to PHP7.4 I had to do the following: sudo chown -R 2 - brew did not remove some useragent for php7.1 which was causing issues with PHP-FPM, so I had to manually remove stuff to clean it out and get brew and valet working with PHP 7.4 Details above were helpful for all of that. But 3 - there was some miscellaneous ValetDriver.php in the ~/.config/valet/Drivers folder that I have no idea how it got there. It could have been there from 2 years ago when I started using valet and for whatever reason, it didnt cause a problem until updating to PHP 7.4. @drbyte can't thank you enough! |
Cool. Glad I was able to help. You can click Close below if you're satisfied that this issue is resolved. |
Thank you guys for the efforts it did help me too |
Hey, just updated to php7.4 and getting the following error:
Fatal error: Uncaught Error: Cannot instantiate abstract class ValetDriver in /Users/###/.composer/vendor/laravel/valet/cli/drivers/ValetDriver.php:77 Stack trace: #0 /Users/###/.composer/vendor/laravel/valet/server.php(111): ValetDriver::assign('/Users/###...', '###', '/') # 1 {main} thrown in /Users/###/.composer/vendor/laravel/valet/cli/drivers/ValetDriver.php on line 77
Any suggestions?
The text was updated successfully, but these errors were encountered: