I am trying to connect to a remote Mysql server using ssl from my PHP Yii application. I am able to establish the connection and am able to query the DB when doing so from yii console using below command
./yii script.
However, the exact same script doesn't work when I am trying to run it on the server using below command
php yii serve --port = 8090
I get the below error :
yii\base\ErrorException: mysqli_real_connect(): (HY000/1045): Access denied for user 'userName'@'IP' (using password: YES).
I have verified the php setting by printing phpInfo()
from both the places, and it is same.
So I am unable to understand what could be the issue here. I would highly appreciate any help/pointers to resolve this.
specification : php 7.1.28, Yii2
Update 1
The application in question has its own specific DB, which I am connecting to using PDO (it is fine). Then there is this remote Mysql server, which I am not able to connect using PDO because of SSL peer match issue. I have tried this resolve by doing
PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => False
but the constant is not present in the PDO. However, if I do
php -r ‘var_dump(PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT);’
i get int(1014) as the output. Not sure why my appilcation is not picking the constant.