I am new to Drupal, so please bare with me. I have a Drupal site that is working fine. Now what I want to do is allow access to folder which contains some custom php script.

I tried to put the folder in the /sites/default/files/ but it didn't work. I found a question on it Extending Drupal Functionality to Custom PHP Page but not able to add Drupal functionality on this page. I just want to access that folder and its content.

So please any help would be appreciated. Thanks

  • Please use correct grammar, question marks etc. Split your text into paragraphs. Also, I think your tag choice is bad, but I'm not sure I understood you enough to retag on my own.
    – Mołot
    Sep 9, 2015 at 12:07
  • 1
    Please avoid using vague terms like "allow access" and "doesn't work". It's just unclear what you're asking.
    – Beebee
    Sep 9, 2015 at 12:27
  • Are you asking just for an include (path/to/script);?
    – Beebee
    Sep 9, 2015 at 12:29

1 Answer 1


The default path or root directory of any Drupal site is the same directory/folder which contains the site itself. ie. Same directory which houses the "sites" directory. If I put a php file there called "my_code.php", any reference to the file will be seen by everything as default. Its when other directories are created and the file placed there which make a file's location more specfic. So if I'm in a php file in another directory and I put in a statement like:

include 'my_code.php';

Drupal will start by looking in its default root directory. If I create a directory there called "my_php_files" and put the "my_code.php" file inside, then my reference to include that file would be:

include 'my_php_files/my_code.php';

Default permissions are normally 755 for directories and 644 for files.


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.