bitnami / vms

Bitnami VMs
https://bitnami.com
Other
203 stars 43 forks source link

Bitname AWS Wordpress - Error establishing a database connection #1363

Closed adam-edmondson closed 7 months ago

adam-edmondson commented 7 months ago

Platform

AWS

bndiagnostic ID know more about bndiagnostic ID

857527a0-fd43-f65b-7652-8ae221e8e12a

bndiagnostic output

===== Begin of bndiagnostic tool output =====

? Apache: Found possible issues
✓ Mariadb: No issues found
✓ Connectivity: No issues found
✓ Wordpress: No issues found
✓ Resources: No issues found
✓ Processes: No issues found
✓ Php: No issues found

[Apache]

Found recent error or warning messages in the Apache error log.

[Mon Jan 15 05:04:20.664591 2024] [authz_core:error] [pid 19146:tid 
140073269962496] [client **ip_address**:43784] AH01630: client denied by server 
configuration: /opt/bitnami/apache/cgi-bin
 [Mon Jan 15 07:24:03.935513 2024] [proxy_fcgi:error] [pid 790:tid 
140035051316992] [client **ip_address**:52168] AH01071: Got error 'PHP message: 
Press [Enter] to continue:
PHP Warning: Undefined array key "HTTP_HOST" in /bitnami/wordpress/wp-config.php 
on line 179PHP message: PHP Warning: Undefined array key "HTTP_HOST" in 
/bitnami/wordpress/wp-config.php on line 180'
 [Mon Jan 15 08:43:23.372287 2024] [proxy_fcgi:error] [pid 2539:tid 
140034036356864] [client **ip_address**:61000] AH01071: Got error 'PHP message: 
PHP Warning: Undefined array key "HTTP_HOST" in /bitnami/wordpress/wp-config.php 
on line 179PHP message: PHP Warning: Undefined array key "HTTP_HOST" in 
/bitnami/wordpress/wp-config.php on line 180'

Please check the following guide to troubleshoot server issues:

https://docs.bitnami.com/general/apps/wordpress/troubleshooting/debug-erro rs-apache/

===== End of bndiagnostic tool output =====

bndiagnostic was not useful. Could you please tell us why?

I am unable to determine how to deal with the error

Describe your issue as much as you can

Out of the blue our production webserver is down and the error when you try an access the website is

Error establishing a database connection

adam-edmondson commented 7 months ago

We are using a Lightsail CDN.

I have just created a snapshot of the server, restored it into a new instance (without the Lightsail CDN) and i can access the website through this new instance.

gongomgra commented 7 months ago

Hi @adam-edmondson,

Thanks for using Bitnami. According to Apache's log error message, you need to set the HTTP_HOST value before the WP_SITEURL and WP_HOME keys. Can you update the file? I see it is only defined for the wp-cli tool at this moment. You will need to add the default definition before that other specific definition. Something like the snippet below (BNDIAGNOSTIC_IP is a substitution of our tool for security reasons, do not modify that line in the file):

$_SERVER['HTTP_HOST'] = '<place-your-IP-or-domain-here>';
if ( defined( 'WP_CLI' ) ) {
    $_SERVER['HTTP_HOST'] = '**BNDIAGNOSTIC-IP**';
}

Once you have updated the file, restart the services for changes to take effect and try to visit the website again

github-actions[bot] commented 7 months ago

This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.

github-actions[bot] commented 7 months ago

Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.