CI: Mysqli - Broken |
So, I've been working with CI since 1.x
Today I've come across the following error I have a database configured as mysqli. All my credentials are correct. <- yes they are. I get this from Codeigniter: Unable to connect to your database server using the provided settings. From logs: ERROR - 2016-05-03 23:01:43 --> Severity: Warning --> mysqli::real_connect(): (HY000/2002): Permission denied /.../database/drivers/mysqli/mysqli_driver.php 202 However, doing a simple php script on the same server using the same credentials connects to the database without issue. Literally copied and pasted the credentials. The php script that works is straight from php.net: \ PHP Code: <?php
Do you try with socket option? Try to config default socket in your system.
e.g: in my localhost, I'm using XAMPP on Mac OS and mysqli defaul socket is: /Applications/XAMPP/xamppfiles/var/mysql/mysql.sock PHP Code: $servername = "127.0.0.1"; Note: use 127.0.0.1 instead localhost
Hey thienhaxanh2405, thanks for the response, sorry did not mention this is an RDS (AWS) server.
The mysqli code works outside of Codeigniter for the remote server connection. Just not the codeigniter driver itself. During the writing of this reply, looked into 1 more thing and discovered this: Code: setsebool -P httpd_can_network_connect_db=1 My working stand alone script was being run command line so, when I tried running it via an http request, I got the error. #$^$#%^ you SElinux. Thanks, hope this helps someone else!
|
Welcome Guest, Not a member yet? Register Sign In |