Valet-plus: Did not get front controller from driver.

Created on 13 Dec 2017  路  8Comments  路  Source: weprovide/valet-plus

I recently upgraded to release 1.0.10, that changes the .dev to .test TLD.

This works fine, ping site.test returns 127.0.0.1. However, when visiting a site (either WordPress/Bedrock or Magento 2), Valet-plus returns the "did not get front controller from driver" error.

I did a bit of debugging in .composer/vendor/weprovide/valet-plus/server.php. The config is loaded to get the paths defined using valet park. This however is ignored, since the apcu cached variable is used for the directory according to server.php:37

$valetSitePath = apcu_fetch('valet_site_path'.$siteName);

A var_dump of this variable returns not a configured path, but a directory inside the ~/.valet/ directory instead of my configured path ~/code/.

Forcing valet-plus to always check the config.json, instead of the cached path in the valet home directory did resolve the issue, but that, naturally, slowed everything down a lot.

Restarting valet to "flush' the apcu cache did not resolve this issue. I was forced to downgrade to an earlier release and it now works properly.

This occurred while using php 7.0, but I haven't tried switching to a different PHP version instead.

Most helpful comment

I followed these steps to getting this working:

  1. composer global update
  2. valet install
  3. sudo valet domain local
  4. sudo valet domain test

All 8 comments

@Bl4ckace Can you please inform me how you forced valet-plus to check the config.json? As a total noob with this issue (yet again) I'm getting frustrated (same as constantly have to switch php version to run some Magento 1 stores and reinstalling PHP again when I do so, but that's another issue).

@Tristan-N You don't really have to force it. I mentioned it somewhat earlier.

You need to modify ~/.composer/vendor/weprovide/valet-plus/server.php and comment at line 37 the $valetSitePath = apcu_fetch('valet_site_path'.$siteName); and redeclare it as $valetSitePath = false.

This would be the value if apcu_fetch returns nothing, instead of the value cached. This does however slow requests down a lot and _isn't_ at all meant to fix the issue.

@Bl4ckace Thank you for your comment. My apologies for not reading well in the first place.
I know this isn't an answer, but a workaround.

That things are being slowed down a lot is no problem: i can't use it now in the first place. It's completely random. I just got one project working again (removed .valet folder and ran valet install, rebooted PC or switching PHP version: they all might solve the issue on a particular project for some reason), but noticed other projects are still having troubles running.

For that reason I will accept the slowing down part of the workaround to be able to work on my projects in the first place.

So again, my apologies and thank you.

I followed these steps to getting this working:

  1. composer global update
  2. valet install
  3. sudo valet domain local
  4. sudo valet domain test

This working for me, thank you very many.

I noticed after changing .dev to .test (sorry, don't know which issue it was mentioned in), I had to link all the projects again.

cd into projectfolder
valet link
valet config

I'm closing this issue since a solution has been provided.

For people arriving here with this problem as I did: the error can be caused by the directory for a link having been moved. Check your links with valet links and re-add any that have disappeared. I did follow rakibabu's steps first (thank you to them), but it didn't help; re-adding my links did.

Was this page helpful?
0 / 5 - 0 ratings