2

I did something stupid and while in the middle of a valet use 7.1 process, I pressed ctrl-C. In an attempt to get everything working since then I uninstalled valet+, did a composer global update, a brew update, valet fix, and valet install yet still every site I visit just spits out "Fatal error: Call to undefined function apcu_fetch() in /Users/n8klatt/.composer/vendor/weprovide/valet-plus/server.php on line 37". Any ideas on how I can get Valet+ working again?

(The initial error after interrupting the valet use 7.1 call was "Unable to determine linked PHP", which I remedied with a brew link --force php@5.6 since 5.6 was what I had been using. That allowed me to proceed with the valet use 7.1 but then all my sites started throwing that apcu_fetch error.)

nklatt
  • 31
  • 1
  • 5

2 Answers2

2

So you're experiencing 2 problems here:

  • Call to undefined function apcu_fetch() is most likely caused by having PHP-FPM run your webserver on a different PHP version as your CLI. Makes sure your webserver is running the same version as your CLI. An easy was to check this is adding the PHPINFO within the server.php file and check the result. Often restarting your PC allows old PHP-FPM instances to die.

  • Unable to determine linked PHP is an error thrown when you're running on a native PHP version which is not installed by brew. In this case valet-plus cannot find the correct version number of your PHP installation and throws this error.

Solutions:

Hope that helps, if not give me a comment.

Neodork
  • 126
  • 1
  • 6
0

I had the same problem with php56. But I'm not using valet, after I reinstall the PHP56 with brew, and it added pear and pecl module. I installed apcu (couldn't install apc directly) with pecl channel-update pecl.php.net and pecl install apcu-4.0.11.

After that installation added extension="apcu.so" in php56 .ini file, which points to /usr/local/Cellar/php@5.6/5.6.38/lib/php/20131226/apcu.so where the image does not exist really because it was installed by PECL, so I had to change php56 .ini to apcu extension to match extension=/usr/local/lib/php/pecl/20131226/apcu.so where the image file resides for real, and then restart apache and it works.

KeitelDOG
  • 4,750
  • 4
  • 18
  • 33