Having problems connecting to a MySQL database running on an EC2 instance
via AWS
Just wanted to first say thank you to all of you. I would not have been
able to make it this far without this site and all the wonderful users.
This is the first question I'm asking, so I apologize ahead of time if my
formatting skills aren't up to speed.
I'm currently attempting to create a system for users to login/register an
account for an iPhone app that I'm developing. I have it working on a
local server, but my attempts to move it to a real server have not been
successful.
I'm running an EC2 instance and made sure to keep open ports 22, 80, and
3066 (sources are all 0.0.0.0/0). I've installed Apache, MySQL, and
PHP/phpMyAdmin. I'm using the AFNetworking framework to handle all the
connections.
What I'm doing is:
API.m // this is where I make a connection with the EC2 instance and below
are the settings for the connection
#define kAPIHost @"http://23.23.245.23:3306"
#define kAPIPath @"photoapp/"
I get a successful connection with my instance, which is great. I can post
the code if you like, but I won't for now as it seems to me it isn't
necessary. The php files which I stuck in photoapp folder I defined above
attempt to connect to the mysql db with:
$link = mysqli_connect("23.23.245.23:3306","root","password");
mysqli_select_db($link, "photoappdb");
What happens is when I try to register a user, the username and password
do not show up in the database when I go over and check in phpMyAdmin.
Again, this all works when I run MAMP and change everything to localhost,
so to me it seems like it would have something to do with how I'm
attempting to connect to the instance or something with the instance
itself. I wanted to look at the php error file to see what's happening,
but despite turning logging on and setting error_log =
/var/log/php-scripts.log I still don't get any log files in that folder.
I'll provide more details if needed, but I'm not sure what else to include
at this point. Does anyone have any input on what to look for in my
instance/db settings that may be preventing my app from making a
connection?
Thanks guys
No comments:
Post a Comment