Zerium
Zerium

Reputation: 17333

How to restrict PHP file access to execution directory?

I have a bunch of PHP scripts inside of, say, /public_html/mydir/, and these scripts may possibly try to delete files / do other stuff to the filesystem.

I want to allow all filesystem modifications within the /public_html/mydir/ directory, but any access (or deletion) outside of the mydir directory shouild not be allowed.

How can I do this?

Upvotes: 1

Views: 293

Answers (1)

Tommos
Tommos

Reputation: 870

You either make a user that only has permission to access these directories, or you have to somehow run PHP in a sandbox like chroot

Upvotes: 2

Related Questions