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 3306 (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://220.127.116.11: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("18.104.22.168: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 deleted some parts of the initial question as I'm getting closer to the source of this. I believe I know what's going on, but I don't know how to get around it
If I set the initial API connection with
kAPIHhost @"http://22.214.171.124:3306", I get a successful connection, but the php files don't run. If I set the initial API connection without the 3306 port like
kAPIHhost @"http://126.96.36.199" the connection fails, but the php files run and I get lots of mysql connection errors.
I attempted to connect directly to the php files via the browser like:
http://188.8.131.52/photoapp/index.php and I get a php output in the log file, but if I go to
http://184.108.40.206:3306/photoapp/index.php with the MySQL port, my browser attempts to download the php file...
So there seems to be some awkward handling of php files. I believe when I try to connect to the correct ip
kAPIHhost @"http://220.127.116.11:3306" I succeed, but then the server will attempt to download the php files to the iphone rather than running them. Can anyone explain this behavior? Thank you!