Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 471
prograhammer Avatar asked Oct 12 '15 04:10

prograhammer


1 Answers

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.

like image 50
Joe Watkins Avatar answered Nov 14 '22 23:11

Joe Watkins