I'm attempting to set a php open_basedir for my website , I've only 2 locations to complete my php script and that i have to disable php on the sub folder within the document root. I'm not sure if this sounds like possible.

would be the doc roots requires php execution


I have to disable php exection around the following dirs



open_basedir = "/home/bastian/html" ; "/home/bastian/meatalheavy"

The setting of open_basedir PHP Manual sets use of a directory tree, not really a specific directory. So if you want to restrict a subdirectory, you mustn't allow some of it's parents.

Note: Based on your directory layout (and PHP version) it appears like this what for you to do is difficult or at best not w/o a lot of configuration (permitting all files and subfolder individually).

Outdoors_basedir setting ought to be written like this:

open_basedir = "/home/bastian/html:/home/bastian/meatalheavy"

This can effectively not prevent execution of php scripts on subdirectories, it will likewise allow inclusion of php scripts (include[_once], require[_once] from subdirectories from the open_basedir. But you might need som other pathways inside your open basedir, any exterior PHP library utilized on the temporary directory (specifically for uploads), or even the session.save_path.

open_basedir = "/home/bastian/html:/home/bastian/meatalheavy:/var/lib/php5/:/path/to/my/php/defined/temporary/dir:/path/to/my/session/dir"

So this is suitable for inclusion (not a way to get rid of a subtree from inclusion), now to avoid php execution on some subdirectories you just need to prevent immediate access to some php script there (different factor as after sales in-php access). For Nginx this ought to be ok:

location ~* ^/(ass_ests|images)/.*\.(php|php5)$
    deny all;

but you might have fun with the mim type as referred to in this blog publish. in which the content from the image directory needs to images, to ensure that a script by having an image extension won't be performed. In FastCgi mode some PHP execution in images files was available. So for the image directory (don't knwo that which you have within the other one) this is

    location /images/
                    image/gif       gif;
                    image/jpeg      jpeg jpg;
                    image/png       png;
                    text/plain      txt;
            default_type    application/octet-stream;
            location ~ \.(php|php5)$