HansSchouten / PHPageBuilder

A drag and drop page builder to manage pages in any PHP project
https://www.phpagebuilder.com
MIT License
721 stars 177 forks source link

MySQL SSL secured connections #130

Open shopapps opened 2 years ago

shopapps commented 2 years ago

Hi,

love the app BTW great job!

I have a requirement to move my pagebuilder database to a MySQL server that has SSL security required on it.

I have change the config/pagbuilder.php as follows to mimic the built in laravel config/database.php:

'storage' => [
        'use_database' => true,
        'database' => [
            'driver'    => env('PB_DB_DRIVER', 'mysql'),
            'host'      => env('PB_DB_HOST').':'.env('PB_DB_PORT',3306),
            'database'  => env('PB_DB_DATABASE'),
            'username'  => env('PB_DB_USERNAME'),
            'password'  => env('PB_DB_PASSWORD'),
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => 'pagebuilder__',
            'prefix_indexes' => true,
            'strict' => true,
            'engine' => null,
            'sslmode' => env('DB_SSLMODE', 'prefer'),
            'options' => extension_loaded('pdo_mysql') ? array_filter([
                PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
                PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => false,
            ]) : [],
        ],
        'uploads_folder' => storage_path('app/pagebuilder/uploads')
    ],

but it looks like your Core/DB.php file around line 32 is not using any passed-in options. Is this something you would be able to add?