本文介绍了无法从我的应用程序连接到我的Amazon Web Services RDS实例:内部服务器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能够从终端(SSH)连接到我的RDS实例,但是,从我的应用程序连接已返回错误代码500:内部服务器错误。



我已将我的安全组配置为我用于EC2实例的安全组。



在我的安全组中,我已经通过端口3306创建了mysql连接规则,来自任何IP(0.0.0.0/0)



附件是我的安全组和RDS实例的图像。



我从stackoverflow上发布的答案中尝试了很多建议。









<! - 开始片段:js hide :false - >



<! - 语言:lang-html - >



echo连接前确定;



$ dsn ='mysql:host = klaudcelet-db.cwjchxqjfoaj.eu-central-1.rds.amazonaws.com ; port = 3306; dbname = providers';

$ username ='klaudcelet';

$ password ='12345678';



//不是真正的密码

$ link = mysqli_connect('klaudcelet-db.cwjchxqjfoaj.eu-central-1.rds.amazonaws.com','klaudcelet',' 12345678','供应商',3306);



ec hoFirst OK;





$ dbh =新PDO($ dsn,$ username,$ password);





echo'OK';





< ; - 结束片段 - >



[我的安全组规则] [1]



[rds配置] [2]



谢谢。





[1]:http://i.stack.imgur.com/Zng4L.png

[2]:http://i.stack.imgur.com/E6Jnc.png

I am able to connect to my RDS instance from the terminal(SSH), however, connecting from my application had been returning error code 500: Internal Server Error.

I have configured my security group to be the security group that i am using for the EC2 instance.

In my security group, I have created rule for mysql connection via port 3306, from any IP (0.0.0.0/0)

Attached is the image of my security group and the RDS instance.

I have tried many suggestion from the answers posted here on stackoverflow.




<!-- begin snippet: js hide: false -->

<!-- language: lang-html -->

echo "OK before connection";

$dsn = 'mysql:host=klaudcelet-db.cwjchxqjfoaj.eu-central-1.rds.amazonaws.com;port=3306;dbname=providers';
$username = 'klaudcelet';
$password= '12345678';

//not the real password
$link = mysqli_connect('klaudcelet-db.cwjchxqjfoaj.eu-central-1.rds.amazonaws.com', 'klaudcelet', '12345678', 'providers', 3306);

echo "First OK";


$dbh = new PDO($dsn, $username, $password);


echo 'OK';


<!-- end snippet -->

[My security group rules][1]

[rds configuration][2]

Thanks.


[1]: http://i.stack.imgur.com/Zng4L.png
[2]: http://i.stack.imgur.com/E6Jnc.png

推荐答案




这篇关于无法从我的应用程序连接到我的Amazon Web Services RDS实例:内部服务器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 12:25