0

For all the Drupal sites I run except one, requesting /sites/default/settings.php in the browser results in a blank page, which seems right and proper.

But for one of my sites (on a different host), requesting /sites/default/settings.php actually results in the file's contents being served to the browser.

I have no idea where the trouble might be: is this a Drupal problem? Apache problem? Doesn't seem to be related to file permissions. How can I ensure that a request to settings.php doesn't serve the file?

As a stopgap measure I've added a line in .htaccess that generates a 410 error when settings.php is requested, but I'd really like to know how this is supposed to work...

6
  • Is the <?php missing from the top of the file?
    – beth
    Mar 19, 2014 at 19:41
  • 1
    Upload a simple PHP script to your web server and see if it works. Sounds to me like you don't have PHP installed/configured on the server, and as such you'd be better served Googling for the answer to that.
    – jdu
    Mar 19, 2014 at 20:12
  • PHP is running just fine. The entire site works as intended except for this issue.
    – matthewn
    Mar 19, 2014 at 20:38
  • <?php is present at the top of settings.php.
    – matthewn
    Mar 19, 2014 at 20:39
  • Have you tried with another PHP file, such as index.php, and see what happens? If you tried, what did you get?
    – apaderno
    Mar 20, 2014 at 5:10

1 Answer 1

2

According to this Stackoverflow question you might need to add this to your server configuration:

AddType application/x-httpd-php .php

Another possibility is an encoding problem, according to this other Stackoverflow question.

1
  • May you expand your answer? Link-only answers are still not considered answers, even if the linked page is on a Stack Exchange site.
    – apaderno
    Mar 20, 2014 at 5:06

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.