0

I operate a small shared server and would like to give some of my users the ability to execute PHP code from the browser (but not all of them) but have been unable to do so.

In the top level directory I have the directive in a .htaccess file:

AddHandler cgi-script .php .pl .py .jsp .asp .htm .shtml .sh .cgi

Options -ExecCGI

to not allow script execution.

In the lower-level folders I have tried to add a .htaccess file with the following directives:

AddHandler cgi-script .php

Options ExecCGI

However this didn't work. The PHP file is returned as text in the browser.

I am running Apache with CentOS. If anyone knows how to set this up would be appreciated.

1 Answer 1

0

AddHandler cgi-script .php

Options ExecCGI

However this didn't work. The PHP file is returned as text in the browser.

Just like you used Options -ExecCGI to revoke privileges, use the exact opposite, Options +ExecCGI to grant them

1
  • I've tried with +ExecCGI too, unfortunately scripts are still not rendered as php in that folder. Maybe I'm missing a directive?
    – Dangus
    Dec 21, 2015 at 4:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .