Has anyone got memcached to work on Laravel Homestead php7 box?

送分小仙女□ 提交于 2019-12-10 14:16:45

问题


I loaded up Laravel/Lumen on the new Homestead php7 box and encountered this error:

FatalThrowableError in MemcachedConnector.php line 51:
Fatal error: Class 'Memcached' not found

Doing a phpinfo(); shows there is no memcached extension, but sudo service memcached status says memcached is running. It seems there is a php7 branch for memcached here: https://github.com/php-memcached-dev/php-memcached/tree/php7

Can anyone guide me on how to get it working in the new php7 Homestead VM?

EDIT: I just saw on the homestead install documentation that it says "Memcached (PHP 5.x Only)". Question still remains on how to get it working.


回答1:


The work on php-memcached for PHP7 is not yet complete, not all tests pass; You can use everything but JSON serialization, I think.

There is no pecl support for PHP7, so right now you need to install extensions manually, like this:

git clone https://github.com/php-memcached-dev/php-memcached
cd php-memcached
git checkout php7
phpize
./configure
make
sudo make install

You must make sure that phpize is the PHP7 version. Additionally, if the php in your PATH is not PHP7, then the php-config in your PATH is not either, in this case you must pass --with-php-config=/absolute/path/to/php7-config to ./configure.




回答2:


I have the same problem, but on Windows when using XAMPP. It seems memcached works for now with PHP 5+ only.

The problem for Windows users is to find the right .dll file named php_memcache.dll (x86/x64 platforms).

I've spent hours looking for a solution, but nothing found. The very fresh description how to use memcached is here:

HOW TO: Install Memcache on XAMPP (Windows 7/8/10)

We still have to wait for PHP7+ implementation.



来源:https://stackoverflow.com/questions/33073141/has-anyone-got-memcached-to-work-on-laravel-homestead-php7-box

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!