masterpowers
4 years ago
1199
10
Guides

Tutorial Guide : Installing PHP REDIS PHP7 Branch On Fresh Install Homestead PHP7 Branch

Posted 4 years ago by masterpowers

Hi I havent Seen Any Tutorial On This Lately So Im Sharing What i Did On a Fresh New Install of Laravel Homestead7 with PHP7

and Install a Php 7 Branch of phpredis/phpredis

SSH in your Vagrant Machine then type the code below

[email protected]:~$ sudo apt-get update
[email protected]:~$ git clone -b php7 https://github.com/phpredis/phpredis.git
[email protected]:~$ sudo mv phpredis/ /etc/
[email protected]:~$ cd /etc/phpredis
[email protected]:/etc/phpredis$  phpize
[email protected]:/etc/phpredis$ ./configure
[email protected]:/etc/phpredis$ make && make install

Note This is an Extension You Need to Enable to Make it Work  in Php 7
This First Command Will Allow You To Call PHPREDIS Facade in Browser

[email protected]:/etc/phpredis$ sudo vim /etc/php/7.0/fpm/conf.d/redis.ini

Inside Vim Paste this
extension=/etc/phpredis/modules/redis.so

:w!     ->write/save
:q  ->exit vim

NOTE This Extension needs To be Enable in PHP ini to ENABLE it on your Command Line Interface Such As Artisan.
The Usual Problem You Will Face If You Wont do this is Get a Redis Class Not Found

[email protected]:/etc/phpredis$ sudo vim /etc/php/7.0/cli/php.ini
then Look for this Word CLI Server
Type
/CLI Server 

Add to the last line of extension

extension=/etc/phpredis/modules/redis.so
:w!     ->write/save
:q  ->exit vim


[email protected]:/etc/phpredis$ sudo service php7.0-fpm restart

[email protected]:/etc/phpredis$ sudo service nginx restart


To Test if PhpRedis Extension is Working
php -r "if (new Redis() == true){ echo \"\r\n OK \r\n\"; }"

It Should Return OK! 

Good Job You Already Set Up PHPRedis on PHP7 Laravel Homestead Branch

Please sign in or create an account to participate in this conversation.