sinkcup / laravel-demo

Laravel Demo(production Docker, CircleCI, Lint, Unit Testing)
0 stars 3 forks source link

laravel redis best practice #3

Open sinkcup opened 5 years ago

sinkcup commented 5 years ago

https://laravel.com/docs/6.0/redis

say:

Before using Redis with Laravel, we encorage you to install and use the PhpRedis PHP extension via PECL. The extension is more complex to install but may yield better performance for applications that make heavy use of Redis. Predis has been abandoned by the package's original author and may be removed from Laravel in a future release.

so we should use PhpRedis not predis. try this:

apt install php-redis

it's fine on local Ubuntu, but faild in Docker "php:7.3-apache", error:

root@b7aea273ec31:/var/www/laravel# apt search php-redis
Sorting... Done
Full Text Search... Done
php-redis/stable 4.2.0-1 amd64
  (none)

root@b7aea273ec31:/var/www/laravel# apt install php-redis
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package php-redis is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'php-redis' has no installation candidate
root@b7aea273ec31:/var/www/laravel# apt install php-redis/stable
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Selected version '4.2.0-1' (Debian:10.1/stable [amd64]) for 'php-redis'
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 php-redis : Depends: php-igbinary but it is not installable
             Depends: php-common (>= 1:7.0+33~) but it is not installable
             Depends: phpapi-20180731
E: Unable to correct problems, you have held broken packages.

try pecl in Docker:

pecl install redis

but it always ask question, how to install silentlly? Google:

https://stackoverflow.com/questions/8141407/install-pecl-modules-without-the-prompts

yes '' | pecl install redis