Can not Connect Drupal to DB only on AWS - drupal

uploaded an existing drupal codebase to a virtual host set up on AWS. it is showing "can not connect to database"
I created database "dbname" and can connect fine through ssh. But can not get settings.php to connect. As far as I can tell the mysql user has all needed permissions to access the db remotely.
what I have
$db_url = 'mysql://username:password#us-west-rds.amazonaws.com/dbname';
Here is example of settings.php with a drupal 7 site of ours that connects fine
$databases = array (
'default' =>
array (
'default' =>
array (
'database' => 'dbname',
'username' => 'dbuser',
'password' => 'password',
'host' => 'us-west-rds.amazonaws.com',
'port' => '3306',
'driver' => 'mysql',
'prefix' => '',
),
),
);

There are several things to check:
do you have the security group open to allow access from your server (as said by Bob Kinney in the other answer)?
do you have a firewall set up on your server that prevents connecting to your RDS instance?
does your user have sufficient rights to connect to your database?
The easiest way to debug this is to use the console mysql command and try to connect to your instance from there:
mysql dbname -u username -p password -h db01b2.ck1dmcn6kfws.us-west-1.rds.amazonaws.com
If this does not work, check the points given above. If this works and does not work in Drupal only, check your PHP code and/or Drupal config.

Sounds like you may not have set up your security groups to allow access from your EC2 instances. You'll want to make sure your DB security group has an ingress rule to allow traffic from your EC2 instance/security group.
How do I control network access to my DB Instance(s)?

You're pointing at the wrong hostname.
'host' => 'us-west-rds.amazonaws.com'
Each individual database instance will have it's own hostname. You can look it up in the AWS Console. The one you're currently pointing to looks like you intended to point to the RDS web service API endpoint.

You might also want to check...
setsebool httpd_can_network_connect_db on

Related

How to Configure Your Domain linked to Firebase Hosting, and maintain mail access (DNS records)

There are already many posts on the web to help you connect your custom domain to Firebase.
In fact, if you have enough experience, you wouldn't even need a guide...it's that simple.
What is NOT commonly known is that, with your default hosting configuration (for example a cPanel hosted service)... Once you've reconfigured the domain's A-record to the Firebase IP, everything pointing to that domain is redirected to the new IP.
For example:
A => yourfunkydomain.com => yourFirebaseIP
A => ftp.yourfunkydomain.com => yourHostingServiceIP
All good...
But what about your MX record?
MX => yourfunkydomain.com
CNAME => mail.yourfunkydomain.com => yourfunkydomain.com
You won't be getting mails any time soon...
The Fix:
MX => mail.yourfunkydomain.com
CNAME becomes A => mail.yourfunkydomain.com => yourHostingServiceIP
So keep in mind, any other records needs to be updated to their own respective IP's.
Hope this helps someone.

Unable to connect to live 'ssl://gateway.push.apple.com:2195'

I am facing issue with APNS php code for push notification on IOS devices, I have two separate connection for Development and Production.
I have configure the development connection on my server by adding the .pem file certificate and Passphares its working perfect and I received the notification also. Have a look my development configuration:
Url: 'ssl://gateway.sandbox.push.apple.com:2195'
$push = new ApnsPHP_Push(
ApnsPHP_Abstract::ENVIRONMENT_SANDBOX,
'APNS_Dev_ISAS.pem'
);
$myNewLogger = new MyNewLogger();
$push->setLogger($myNewLogger);
// Set the Provider Certificate passphrase
$push->setProviderCertificatePassphrase('1234567');
$push->setRootCertificationAuthority('APNS_Dev_ISAS.pem');
$push->connect();
Issue:
Than I configured the connection for Production by adding following parameters but I getting the connection error:
Url: ssl://gateway.push.apple.com:2195
$push = new ApnsPHP_Push(
ApnsPHP_Abstract::ENVIRONMENT_PRODUCTION,
'APNS_PROD_ISAS.pem'
);
$myNewLogger = new MyNewLogger();
$push->setLogger($myNewLogger);
// Set the Provider Certificate passphrase
$push->setProviderCertificatePassphrase('12345678');
$push->setRootCertificationAuthority('APNS_PROD_ISAS.pem');
$push->connect();
Error of connection:
INFO: Trying ssl://gateway.push.apple.com:2195...ERROR: Unable to connect to 'ssl://gateway.push.apple.com:2195': (0)
INFO: Retry to connect (1/3)...INFO: Trying ssl://gateway.push.apple.com:2195...ERROR: Unable to connect to 'ssl://gateway.push.apple.com:2195': (0)
INFO: Retry to connect (2/3)...
INFO: Trying ssl://gateway.push.apple.com:2195...ERROR: Unable to connect to 'ssl://gateway.push.apple.com:2195': (0)
INFO: Retry to connect (3/3)...
INFO: Trying ssl://gateway.push.apple.com:2195...ERROR: Unable to connect to 'ssl://gateway.push.apple.com:2195': (0)
I google the issue and I found the some solutions and I have check all and everything is fine but no success.
I have used the correct path for development and production.
I have created the separate certificate .pem files for both and tested the certificate on pusher app. Certificate are correct.
Port is also fine and no blocking from my server because same port is used in development url and development server push notification working fine.
Any help will be appreciated really. Thanks in advance.
Certificate (.pem) having issue that I was created for push notification.
Solution:
After few days trying on same issue I found that create certificate with mini character passpharess may be 1234, It will work perfect for you and make successful connection to IOS push notification server.
May be this will help someone else.
Thanks.
I was getting same problem when I execute my PHP script. After some research, I commented these three key-pair values 'cafile', 'CN_match' and 'ciphers'.
Then its started working properly. I hope this reply become useful to any other person as well.
$contextOptions = array(
'ssl' => array(
'verify_peer' => false, // You could skip all of the trouble by changing this to false, but it's WAY uncool for security reasons.
// 'cafile' => 'NiteVisionWebPushFile.pem',
// 'CN_match' => 'gateway.push.apple.com', // Change this to your certificates Common Name (or just comment this line out if not needed)
// 'ciphers' => 'HIGH:!SSLv2:!SSLv3',
'disable_compression' => true,
));

Alfresco with Drupal CMIS

I am attempting to configure Drupal CMIS to connect to the Alfresco public test repository.
I am using this CMIS module
https://www.drupal.org/project/cmis
I am using Alfresco 4.x CMIS Content Repository as found here
https://www.alfresco.com/cmis
The problem is that when i try to browse the repository in drupal I get the following message
There has been an problem contacting the CMIS server, please see the logs.
The error log always reads
HTTP call to [repository link here, shown in code sample bellow] returned [307]. Response: Authentication Required Authentication Required
my Drupal settings file contains the following
$conf['cmis_repositories'] = array(
'default' => array(
'user' => 'admin',
'password' => 'admin',
'url' => 'http://docs.oasis-open.org/ns/cmis/ws/200908/'
)
);
The config is copy/pasted from the modules documentation and includes the URL which appears in the error message. Also I have viewed the $conf global using print('' .print_r($conf,true) . '') so I definitely have settings.php correct.
is my admin, pass, url combination still valid (ie is the site up to date)
what else could be causing this?
Your url seems to be wrong.
Please try with http://cmis.alfresco.com/cmisatom (Atompub ) , http://cmis.alfresco.com/cmisbrowser (json)
Links are there in the alfresco web link mentioned by you
cheers,
Saurav

How Cakephp2.x connect Oracle 11g?

I could not connect oracle with cakephp2, After search a few hour i found and followed link step by step still not success, my oracle 11g
error:
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
I found solution with many errors, here what i fixed:
(Note still follow this link)
Error with php version 5.4.+ ,p 5.3.0 (wamp server)
Error with oracle php file file with override function (method not compatible )
Error connect database config
Error SELECT * FROM your table name [don't use select * that will work]
How to fix:
If still php 5.3.0 enable module oci8
Use this oracle file database i have been modified
in Cakephp Config database.php use
public $dboracle = array(
'datasource' => 'Database/Oracle',
'driver' => 'oracle',
'connect' => 'oci_connect',
'persistent' => true,
'host' => "your host database ip",
'login' => 'db user name',
'password' => 'db password',
'database' => '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=you db ip )(PORT=1521))
(CONNECT_DATA=(SID= you sid)))',
'prefix' => '',
'schema' => 'schema_name'
);
First, the ORA error is a permutation of the ORA-12514: TNS listener cannot resolve service name error as shown below. This form of the ORA-12541 error commonly happens when the database or the listener processes are in the middle of a startup, or when the database (mysid in your case) has not been registered with the listener.
root> oerr ora 12514
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
Cause:
The listener received a request to establish a connection to a
database or other service.
The connect descriptor received by the listener specified a service
name for a service (usually a database service) that either has not
yet dynamically registered with the listener or has not been
statically configured for the listener.
This may be a temporary condition such as after the listener has
started, but before the database instance has registered with the
listener.
Action:
Wait a moment and try to connect a second time.
Check which services are currently known by the listener by
executing: lsnrctl services
Check that the SERVICE_NAME parameter in the connect descriptor of
the net service name used specifies a service known by the listener.
If an easy connect naming connect identifier was used, check that the service name specified is a service known by the listener.
Check for an event in the listener.log file.

Wordpress - Upload media to different server

I've split the resources on a WP site into two servers: Server A with administration files, Server B with public files. They are connected by the data base.
Are there any way that will cause media that I upload from the WP admin installation on Server A to be stored over on Server B? Whit this, that media will be served from Server B ("public site").
If possible, other than through an FTP connection, my client doesn't want a FTP in the public site :-(
Thanks in advance!
First, create a remote storage service where you can post the file and return a URL addressing the file on server B. Then you can use wp filters to attain the url from server A.
You can hook into this filter: "wp_handle_upload"
apply_filters{
'wp_handle_upload'
array( 'file' => $new_file, 'url' => $url, 'type' => $type ), 'upload'
)
just replace the URL to the new one

Resources