phpfastcache v6.1.4 and redis is up running on default port 6379 through Kubernetes.
PHP Fatal error: Uncaught phpFastCache\Exceptions\phpFastCacheDriverCheckException: Redis is not installed or is misconfigured, cannot continue.
Also, please verify the suggested dependencies in composer because as of the V6, 3rd party libraries are no longer required. in /Users/my-path/vendor/phpfastcache/phpfastcache/src/phpFastCache/Drivers/Redis/Driver.php:46
In the config.php.
return [
'driver' => 'redis',
'maxRetries' => 3,
'config' => [
'defaultTtl' => 900,
'host' => 'localhost',
'port' => 6379,
'database' => 11,
'password' => 'some password',
'timeout' => 3,
],
];
So how to setup the Redis config properly?
I answered you on the Github Discussion here.
You either missed the php-redis extension or the php.ini configuration.
However the version 6.1.4 of pfc is no longer supported, I strongly encourage you to upgrade to 8.1 or 9.x.
Related
I am using pusher in laravel to send notification but i'm getting following error:
{message: "Failed to connect to Pusher.", exception:
"Illuminate\Broadcasting\BroadcastException",…} exception:
"Illuminate\Broadcasting\BroadcastException" file:
"C:\wamp64\www\notify\vendor\laravel\framework\src\Illuminate\Broadcasting\Broadcasters\PusherBroadcaster.php"
line: 121 message: "Failed to connect to Pusher."
.env:
APP_URL=http://localhost
BROADCAST_DRIVER=pusher
PUSHER_APP_ID=XXX
PUSHER_APP_KEY=XXXX
PUSHER_APP_SECRET=XXX
PUSHER_APP_CLUSTER=ap2
broadcasting.php
'pusher' => [
'driver' => 'pusher',
'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'),
'app_id' => env('PUSHER_APP_ID'),
'options' => [
'cluster' => env('PUSHER_APP_CLUSTER'),
'useTLS' => false,
'host' => '127.0.0.1',
'port' => 6001,
'scheme' => 'http',
'curl_options' => [
CURLOPT_SSL_VERIFYHOST => 0,
CURLOPT_SSL_VERIFYPEER => 0,
],
],
Unfortunately, there are several things that might cause this. The one that gets me over and over again, though is that the time on my server is out of sync with the allowance window from Pusher. This happens on one of my VMs when I sleep the laptop.
Check your logs, and check your VM system time. If it is more than a tiny bit out, this could be your issue.
To fix the time issue on a Linux server (and then try again), you can use NTP if you don't have another way:
sudo apt install ntpdate
sudo ntpdate ntp.ubuntu.com
sudo timedatectl set-ntp on
sudo service ntp stop
sudo ntpd -gq
sudo service ntp start
Running Laravel 5.7 via Homestead.
This is happening in:
/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php
"line":66
"function":"establishConnection"
We are using PHP Redis and in config/database.php:
'redis' => [
'client' => 'phpredis',
'default' => [
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => 6,
],
],
I've seen other answers on here and none of the steps work. There is no redis cluster in use. PhpRedis extension is installed on VM and confirmed with php -m. Redis server is running at 127.0.0.1 and can be connected to outside of the code.
I'm unable to change the code as it works for others. It must be a configuration issue on my VM but I can't see what it could be. If anyone has had a similar issue I'd much appreciate any advice.
The problem you are having is because of class naming conflict: PhpRedisConnector creates new \Redis client, but it seems that you have alias for Illuminate\Support\Facades\Redis facade set up somewhere in your app. PhpRedisConnector creates new Redis and gets facade object instead.
Try removing this line in your config/app.php:
'aliases' => [
...
'Redis' => Illuminate\Support\Facades\Redis::class, // remove this line
...
]
I just installed Laravel 5.7 on my windows 7 machine and I want to use Sybase Central (v6.1) as my database but I can not seem to figure out how to connect to it.
I did a lot of google search but there is not much information out there when it comes to Sybase. This is what I'm trying but it does not work.
'connections' => [
'sybase' => [
'driver' => 'odbc',
'host' => env('DB_HOST', 'host-name'),
'port' => env('DB_PORT', 'port-number'),
'database' => env('DB_DATABASE', 'db-name'),
'username' => env('DB_USERNAME', 'user'),
'password' => env('DB_PASSWORD', 'password'),
'charset' => 'utf8',
'prefix' => '',
]
]
The error I get
InvalidArgumentException: Unsupported driver [odbc] in \vendor\laravel\framework\src\Illuminate\Database\Connectors\ConnectionFactory.php:283 Stack trace: #0
Does Laravel support Sybase or not?
Out of the box, Laravel doesn't look to support odbc, but there seems to be a package you can install to support it available at ODBC integration for Laravel Framework.
Simply follow the installation and usage guides on the page, and you should be able to use "driver" => "odbc" without issue.
From terminal run
composer require abram/laravel-odbc
Then configure the following files:
config/database.php
"connections" => [
"sybase" => [
"driver" => "odbc",
...
]
]
config/app.php
"providers" => [
...
Abram\Odbc\ODBCServiceProvider::class
]
I am using laravel 5.2 and having an architecture of multi-server autoscaling. I want to have session and cache in a centralized location. I want to use AWS elasticache for the same.
I have setup an elasticache Redis cluster having following options :
Parameter group : default.redis.3.2.cluster.on
Shards : 3
Total Nodes : 9
In laravel session configuration I have set redis as the session driver.
In database.php where redis configuration is set, i have used following :
REDIS_HOST=my_aws_elasticache_configuration_endpoint
REDIS_PASSWORD=null
REDIS_PORT=6379
.
When I try to use it, I get following error :
MOVED 13841 some_ip_address_of_aws:6379
I tried using local redis and it worked, so predis is working properly. I tried to check the solutions online, but not able to get the solution. I believe that the configuration endpoint is trying to redirect the redis connection to an available node url out of the 9 nodes I have. However, I have anticipated that AWS should do it internally and not throw exception. Can anyone help me?
I finally got an answer, we need to get the cluster mode on in database settings and set new cluster option to redis. This is how the redis config in database.php looks like :
'redis' => [
'client' => 'predis',
'options' => [
'cluster' => 'redis',
],
'clusters' => [
'default' => [
[
'host' => env('REDIS_HOST', 'localhost'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => 0,
],
],
],
],
If you have password then you can replace options array with this :
'options' => [
'cluster' => 'redis',
'parameters' => ['password' => env('REDIS_PASSWORD', null)],
],
I am getting this error:
MongoDB\Driver\Exception\InvalidArgumentException: Failed to parse MongoDB URI: 'mongodb://mongo:tcp://172.17.0.3:27017/mydatabase' in /var/www/laravel/vendor/mongodb/mongodb/src/Client.php:81
My enviroment variables look like this:
MONGO_DATABASE="mydatabase"
MONGO_HOST="mongo"
MONGO_PASSWORD=""
MONGO_PORT="27017"
MONGO_USERNAME=""
and my database.php looks like this
'mongodb' => [
'driver' => 'mongodb',
'host' => env('MONGO_HOST', 'localhost'),
'port' => env('MONGO_PORT', 27017),
'database' => env('MONGO_DATABASE', 'mydatabase'),
'username' => env('MONGO_USERNAME', ''),
'password' => env('MONGO_PASSWORD', ''),
'options' => [
'database' => 'admin' // sets the authentication database required by mongo 3
]
I can correctly ping mongo from the container and it resolves to 172.17.0.3 as per the connection string. It seems as if the rest of the connection string is not getting generated correct?
I am running Laravel 5.2 and my package.json has this entry
"mongodb/mongodb": "^1.0.0",
"jenssegers/mongodb": "3.0.*",
As per https://github.com/jenssegers/laravel-mongodb 3.0.X is highest compatibility for Laravel 5.2.
Many thanks in advance
After further investigation my link from Amazon ECS was passing another MONGO_PORT which was overriding the env set in my .env file.