You need to add the AWS SSL certificates to the PDO connection to make it
work.
In symfon ythis means this configuration for DBAL Connection. you need to
check what this translates to when creating via
DriverManager::getConnection()
options:
MYSQL_ATTR_SSL_CA:
"%kernel.root_dir%/config/rds-combined-ca-bundle.pem"
On Thu, Jun 27, 2019 at 9:28 PM Nathaniel Goodwin <[email protected]>
wrote:
> This is within the Symfony Doctrine framework. Database connection has to
> be initiated through the configuration. I will test manually connecting and
> let you know what the result is!
>
>
> On Thu, Jun 27, 2019 at 3:26 PM Marco Pivetta <[email protected]> wrote:
>
>> $pdo = new PDO(/* parameters */);
>>
>> var_dump($pdo->query('SELECT 1')->fetch());
>>
>> Marco Pivetta
>>
>> http://twitter.com/Ocramius
>>
>> http://ocramius.github.com/
>>
>>
>> On Thu, Jun 27, 2019 at 9:22 PM Nathaniel Goodwin <[email protected]>
>> wrote:
>>
>>> I am able to connect via the ubuntu bsh command line and I am able to
>>> connect via a previous version of my API which uses Symfony 3.x and
>>> previous versions of doctrine.
>>> It is only from Symfony 4.2 and updated doctrine (my new API) that the
>>> connection issue arises.
>>>
>>> What do you mean by connect via plain PDO?
>>>
>>>
>>>
>>> On Thursday, June 27, 2019 at 3:12:32 PM UTC-4, Marco Pivetta wrote:
>>>>
>>>> Are you able to connect with plain PDO?
>>>>
>>>> Marco Pivetta
>>>>
>>>> http://twitter.com/Ocramius
>>>>
>>>> http://ocramius.github.com/
>>>>
>>>>
>>>> On Thu, Jun 27, 2019 at 9:03 PM Nathaniel Goodwin <[email protected]>
>>>> wrote:
>>>>
>>>>> Using
>>>>>
>>>>> ```
>>>>> "php": "^7.1.3",
>>>>> "doctrine/doctrine-bundle": "^1.11",
>>>>> "doctrine/doctrine-fixtures-bundle": "^3.1",
>>>>> "doctrine/doctrine-migrations-bundle": "^2.0",
>>>>> "doctrine/orm": "^2.6",
>>>>> "friendsofsymfony/oauth-server-bundle": "^1.6",
>>>>> "friendsofsymfony/rest-bundle": "^2.5",
>>>>> "friendsofsymfony/user-bundle": "^2.1",
>>>>> "jms/serializer-bundle": "^3.3",
>>>>> "symfony/asset": "4.2.*",
>>>>> "symfony/yaml": "4.2.*"
>>>>> ```
>>>>>
>>>>> I cannot seem to get my configuration correct to connect my Symfony
>>>>> Doctrine PHP API to my MySQL database on AWS DB instance. I am running
>>>>> Ubuntu 16+ on all my instances. I am able to connect my local API to my
>>>>> local MySQL without any problems, and I am able to connect my testing
>>>>> server in the same way, but when I move to my production server on AWS,
>>>>> and
>>>>> I try to run the following:
>>>>>
>>>>> ```
>>>>> php bin/console doctrine:schema:update --force --env=prod --complete
>>>>> ```
>>>>>
>>>>> I get the following error:
>>>>>
>>>>> ```
>>>>> In AbstractMySQLDriver.php line 93: An exception occurred in driver:
>>>>> SQLSTATE[HY000] [2002] No such file or directory
>>>>> ```
>>>>>
>>>>> I have tried multiple configuration settings and many searches, but in
>>>>> almost all cases the issues were with settings using localhost versus
>>>>> 127.0.0.1, and that is not my issue as I am trying to connect from an AWS
>>>>> EC2 (hosting my API) to an AWS DB instance.
>>>>>
>>>>> I have checked multiple times and my username, database, password, and
>>>>> path configurations are correct, I have tested them via manual login to
>>>>> the
>>>>> DB instance.
>>>>>
>>>>> Here is the config in my config/packages/doctrine.yaml
>>>>>
>>>>> ```
>>>>>
>>>>> doctrine:
>>>>> dbal:
>>>>> # configure these for your database server
>>>>> driver: 'pdo_mysql'
>>>>> server_version: '5.7'
>>>>> charset: utf8
>>>>> default_table_options:
>>>>> charset: utf8
>>>>> collate: utf8_unicode_ci
>>>>> host: '
>>>>> api-database.XXXXXXXXXXX.ca-central-1.rds.amazonaws.com'
>>>>> port: '3306'
>>>>> dbname: 'XXXXXXX'
>>>>> user: 'XXXXX'
>>>>> password: 'XXXXXXXXXXXXXXXXXXXXXXX'
>>>>> orm:
>>>>> auto_generate_proxy_classes: true
>>>>> naming_strategy: doctrine.orm.naming_strategy.underscore
>>>>> auto_mapping: true
>>>>> mappings:
>>>>> App:
>>>>> is_bundle: false
>>>>> type: annotation
>>>>> dir: '%kernel.project_dir%/src/Entity'
>>>>> prefix: 'App\Entity'
>>>>> alias: App
>>>>> monolog:
>>>>> handlers:
>>>>> main:
>>>>> type: stream
>>>>> path: '%kernel.logs_dir%/%kernel.environment%.log'
>>>>> level: debug
>>>>> channels: ['!event']
>>>>>
>>>>> ```
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "doctrine-user" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to [email protected].
>>>>> To post to this group, send email to [email protected].
>>>>> Visit this group at https://groups.google.com/group/doctrine-user.
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/doctrine-user/4d8b86ce-61e5-4c8c-a685-83c68eea8c91%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/doctrine-user/4d8b86ce-61e5-4c8c-a685-83c68eea8c91%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "doctrine-user" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at https://groups.google.com/group/doctrine-user.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/doctrine-user/a388a9a7-98d5-469a-ae4a-782d72ee9010%40googlegroups.com
>>> <https://groups.google.com/d/msgid/doctrine-user/a388a9a7-98d5-469a-ae4a-782d72ee9010%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "doctrine-user" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at https://groups.google.com/group/doctrine-user.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/doctrine-user/CADyq6s%2BamcDPWOBmy%3DmW-OrT8Af85_x8cYZqXXBRj%3D2cUN-LQg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/doctrine-user/CADyq6s%2BamcDPWOBmy%3DmW-OrT8Af85_x8cYZqXXBRj%3D2cUN-LQg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> Nathaniel Goodwin
> Fitchek | Lead Developer
> 28 Deakin Street, Suite 202, Ottawa ON Canada
> [email protected] | fitchek.com
> Office: 613.627.4364
>
> --
> You received this message because you are subscribed to the Google Groups
> "doctrine-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/doctrine-user.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/doctrine-user/CAOfeQDBwu8ugqYvYecLftXV6B8C1zzgWKb1QV5DGrWn83L4raA%40mail.gmail.com
> <https://groups.google.com/d/msgid/doctrine-user/CAOfeQDBwu8ugqYvYecLftXV6B8C1zzgWKb1QV5DGrWn83L4raA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/doctrine-user.
To view this discussion on the web visit
https://groups.google.com/d/msgid/doctrine-user/CAEPJdukLa%3DKkHGcNRa-k0oqSbh%2B%2BRzo4tjVj1pFKci_dK_PJFg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.