I'm trying to allow a simple php script (that has nothing to do with drupal) to run in a subdirectory, but apache won't run the script - it just returns the entire php file to the browser, which of course causes the browser to ask if you want to save it. I don't think the problem is with rewrite because the URL isn't rewritten - I can access the file. The problem is that apache doesn't execute the script. I've poured over the .htaccess and php.ini files but can't find anything that looks like it will enable the php script to run in a subdirectory. This script runs fine when it's outside of the drupal file system. Any help or pointers would be greatly appreciated.
TIA, Matt

Comments

matter9’s picture

The solution to my problem was that there was a SetHandler directive in the files folder under the drupal folder, which had the following line

SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
Options None
Options +FollowSymLinks

Once the SetHandler line is commented out, the script will execute. Of course, that leaves a security hole where others might put bad scripts, but that isn't an issue in this case.

drinkdecaf’s picture

Is there a way to allow/specify specific php files, while keeping the security handler in place?

drinkdecaf’s picture

in .htaccess, add:

<Files myfile.php>
SetHandler None
</Files>
saiprasad kandavalli’s picture

hi drinkdecaf , i used code

SetHandler None

in .htaccess file. but its not working. i used my file xxxx.html file in sites/default/files/mynewfolder/detect/xxxx.html and i tried with so many ways like

SetHandler None

but not working.

Any suggestions regarding this.