4

I've installed Drupal on Red Hat 7 in Amazon Web Services, using a database on a separate RDS instance.

My original problem was that I couldn't make the Drupal installer recognize the /sites/default/ or /sites/default/files directories as writable, even after I confirmed they were writable by the ''apache'' user or temporarily set the permissions to writable by all. (This year-old issue may be similar.) When I filled in settings.php myself, then Drupal gave this connection error:

PDOException: SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'my-database-endpoint.rds.amazonaws.com' (13) in lock_may_be_available() (line 167 of /var/www/html/includes/lock.inc).

Disabling SElinux allows the installer to finish and allows Drupal to work. Re-enabling SElinux ('''setenforce 1''') stopped the installer; re-enabling SElinux after installation breaks Drupal, resulting in the same connection error given above. Drupal.org mentions the problem, but doesn't give a specific solution for this case.

I figure many other people must have run into the same problem when installing Drupal.

Obviously I have to re-enable SElinux, so does anyone already know how to modify SElinux configurations to enable Drupal to work properly (and not degrade security)?

1 Answer 1

2

Looks like you are connecting to a remote host. You may need to allow httpd to make remote connections. Run these commands as root to set the SELinux variables.

setsebool -P httpd_can_network_connect 1
setsebool -P httpd_can_network_connect_db 1

http://alexbilbie.com/2013/02/selinux-php-mysql/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.