سؤال

I am currently using AWS Elastic Beanstalk to launch a LAMP environment. Due to Elastic Beanstalk being an multiple instance environment, $_SESSION is not configured to work correctly and it is recommended to use DynamoDB Session Handler. This works fine for me with the following code inserted prior to session_start();

require 'vendor/autoload.php';

use Aws\DynamoDb\DynamoDbClient;
use Aws\DynamoDb\Session\SessionHandler;

$dynamoDb = DynamoDbClient::factory(array(
    'key'    => 'XXXX',
    'secret' => 'XXXX',
    'region' => 'us-east-1'
));

$sessionHandler = SessionHandler::factory(array(
    'dynamodb_client' => $dynamoDb,
    'table_name'      => 'sessions',
));
$sessionHandler->register();

But, this does not work app wide and is causing issues getting phpMyAdmin up and running. How do I make this work app wide?

هل كانت مفيدة؟

المحلول

AFAIK, there is no way to configure a custom session handler from a php.ini, and to use the DynamoDB Session Handler, you must bootstrap it somehow. For an app with multiple entry points, this presents a challenge. One idea you could try is using the auto_prepend_file INI setting to run the bootstrap code.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top