awslabs / aws-elasticache-cluster-client-memcached-for-php

Amazon ElastiCache Cluster Client is an enhanced PHP library to connect to ElastiCache clusters. This client library has been built upon libmemcached and is released under the Apache License.
Other
62 stars 33 forks source link

Unable to connect with TLS on PHP 7.4 #55

Open danielnguyen1612 opened 2 months ago

danielnguyen1612 commented 2 months ago

Hi all, I'm trying to connect to Elasticahe Memcached with TLS on PHP 7.4. I already installed PHP extension which downloaded from AWS Console. But I am getting these errors (it does not happen with extension on PHP 8.2)

Fatal error: Memcached::createAndSetTLSContext(): Failed to create/set TLS context: Client cert and key must both be specified

These are my code for your reference

$client = new Memcached();
$client->addServers([
   ...
]);

$client->setOption(MemcachedDriver::OPT_USE_TLS, 1);
$client->createAndSetTLSContext([
    'hostname'             => '*.....',
    'skip_cert_verify'     => false,
    'skip_hostname_verify' => false,
]);

$client->set('test_memcached', 'memcached');

Thanks you in advanced