I've developed a Laravel app locally and connected locally to a database instance of Amazon Aurora. Had no problems connected to that DB locally but now that I've migrated to production, I get a
SQLSTATE[HY000] [2003] Can't connect to MySQL server on '[AMAZON AURORA URL HERE]' (4)
error. I'm hosting on MediaTemple. I've got the database access on Amazon set to public, so not sure why I wouldn't be able to connect using the same settings I'm connecting to locally.
Make sure to check your inbound security group settings.
When you create a new RDS instance, the launch wizard automatically creates a security group that allows your local IP (so it makes sense you've been able to log-in on your local dev).
Make sure to go in to that security group and also add the CIDR/IP of your MediaTemple server.
Related
We have a windows server setup in our premises where we host our FileMaker server (FMS 15).
We are thinking of moving the host into a cloud server (FMS19).
We have taken the latest backup of our databases (from FMS 15) and uploaded it into the cloud server (FMS 19).
The extension of the backup file is .fm12 so it was uploaded easily from FMS15 to FMS 19. Database structure remains exactly the same and the connection from FileMaker pro is also working fine.
The Issue
One of these databases (database db_fm for example) is connected to our website. A cron job runs every 5 minutes on our website that syncs information from the website's database (db_website) to that of FileMaker's databases (db_fm). The sync uses FileMakers “PHP Web Publishing”
After uploading the latest backup in the cloud server (FMS 19) I have changed the host address in the config file
i.e; I have changed the host address from
//host for our internal server
$FileMakerHost = 'http://77.**.***.40:8080';
to
//host for cloud server
$FileMakerHost = 'https://a*****2.fmphost.com/ ;
Database structure and the password for the Filemaker database remained the same. So have not changed anything else other than the host address.
The synchronization works with the current database (hosted in our windows server FMS15) but it is not working with the new host (hosted in cloud server FMS19).
After changing the host address we have created a test subscriber. That record should be added to the FileMaker database (i.e the one hosted in cloud server). But there is no new record created.
Can you please assist me with what can be the issue? I cannot think of anything else other than changing the host address. What can I do to make it work with both servers?
FYI
The sync uses filemakers “PHP Web Publishing” The cloud server
(FMS19) is also in windows and PHP publishing engine is enabled
Our site is built with laravel.
The main problem was the new host address was https. The sync was working for HTTP address not https.
Following are things that we have done to make it work
We added an outbound rule in our webserver (where our website is hosted) on port 443.
Then we have reset the cache via ssh. systemd-resolve --flush-caches
. Because automatic redirect was cached
FMPHOST (The hosting company) suggested us, to test from PHP so that it can get any response from https://a******.fmphost.com/ or http://a******.fmphost.com/ (Use curl commands to prove port is not blocked between the web server and FileMaker Server)
Thank you
I have a multi server set up at Amazon, an Aurora DB cluster, a staging EC2 instance (1), a development EC2 instance (3), and I just launched a production EC2 instance (2).
All of the EC2 instances were created in Laravel Forge and are deployed via Envoyer.
All 3 EC2 instances use the same host and login credentials for the DB cluster, just different databases.
Server 1 and server 3 connect to the DB just fine, but the new production server 2 throws the following error:
[PDOException]
SQLSTATE[HY000] [2002] Connection timed out
Server 1 and server 2 are exactly the same Laravel application, just different branches, and have different .env files, but the DB credentials are exactly the same.
Does anyone have any ideas as to why I would get a timed out error when the credentials are the same?
I've double checked the security settings for Aurora and it's set to receive all public traffic (for the time being) so it's not that.
How can I trace this in Laravel or another tool to troubleshoot this?
Also I can connect remotely to the DB from my Macs through SequelPro with no issues as well.
Both branches of the code are up to date as well. It's simply the production server that won't connect.
I have made a website and it is currently hosted on Netfirms.
The following is my code that I'm using to connect to my amazon web services database:
<?php
$connect_error = 'Sorry, we\'re expericing connection problems.';
mysql_connect('xxxxxx.xxxxxxxxxx.us-west-2.rds.amazonaws.com','myusername','mypassword') or die($connect_error);
mysql_select_db('invest') or die($connect_error);
?>
However, I'm getting this error:
Warning: mysql_connect(): Can't connect to MySQL server on
'xxxxxx.xxxxxxxx.us-west-2.rds.amazonaws.com' (111) in
/hermes/bosnaweb03b/b2442/nf.liangbros/triumph/core/database/connect.php
on line 6
What can I do to resolve this? Is it something wrong with AWS or is there something I can set on netfirms and/or AWS? I made the dev website and tested it using easyPHP on my localhost and everything works (successfully connects to amazon web services) but after uploading all my files onto my netfirms host, it cannot connect to AWS database. I need this site up and running before end of month December, please help! Thanks!
I have tried to change the security group on my AWS database to the following:
netfirms (sg-ce2d23aa)
For this security group, I set the following:
inbound settings
The following is a snapshot of my database on AWS:
AWS database
Your RDS has a security group, and it's also part of a VPC that has it's own security group. Right now your RDS allows all traffic that can reach it, but I would be willing to bet that your VPC security group does not allow the traffic coming or going to pass to the subnet. I would also recommend using the MySQL/Aurora (3306) vs the All Traffic option, then set the source to 0.0.0.0/0. You also need to check your EC2 instance security group to insure it has the right inbound and outbound settings that you need.
Not sure if what I am attempting to do is possible or not. I just launched my very first EC2 instance running Ubuntu 12.04 and successfully installed Laravel 4. I have the database working just fine on the EC2 instance and I am able to connect to it with MySQL Workbench on my local machine using a .pem SSH key.
I will be using EC2 to handle certain aspects of a product that I am developing to ensure improved reliability - client side users will be interacting with this primarily through CURL. I want to be able to have my non-EC2 website, also running Laravel 4, use the MySQL database that I set up on my EC2 instance.
I tried changing my app/config/database.php file to include the EC2 instance IP address and MySQL credentials, when Laravel attempts to connect it returns a timeout error.
I modified my.cfn and commented out bind-address = 127.0.0.1, I do not seem to have the skip-network that I have seen mentioned. Still no joy.
Any suggestions?
In side MySQL (PhpMyAdmin if you installed it) -> Users overview -> Edit your user with Host is
%
That is mean, you can connect to MySQL in anywhere with command
mysql_connect($IpOfYourHost, $UserAbove, $Password)
Maybe this helps you. :)
Resolved
I changed bind-address to 0.0.0.0, created a new MySQL user - 'user'#'%', and had my host whitelist the IP. Done!
I have developed a web application that uses PHP and MySQL and has all been running fine from a single development server. I now want to separate things a bit and place an app server within Amazons cloud that will receive and process uploaded files. The database is going to remain on the dedicated server but will need to be accessed by the EC2 instance.
Heres what I have tried so far...
In phpMyAdmin I added a new user to the privileges table. I gave it the elastic IP address from AWS as the host name, a new password and granted privileges to INSERT, SELECT and UPDATE.
In the PHP scripts on my EC2 based app server I included this username, password and the domain name of the location of the mysql server (example.domain.net) when connecting with mysql_connect
I have a simple test page that tries to SELECT and echo some results from the database but get the following error -
Could not connect to MySQL: Can't connect to MySQL server on 'example.domain.net' (4)
What could this mean, what have I missed, are there any other issues such as trying to do this from within EC2 that will cause other problems?
cheers all
Turns out the only other thing I needed to do was to open port 3306 on the database server to allow access. Did this by going to Control Panel -> Windows Firewall -> Exceptions -> Add Port ["SQL", 3306]
Now it works great!