Restricting PHP's disk access to its own virtual host

I have this setup:

- Red Hat 7.2
- PHP 4 (Apache module)
- Apache 1.3 (running as nobody:nobody)
and several name-based virtual hosts running on this system using the same IP.

I would like to set it so that PHP scripts running on a certain virtual host cannot access the other host's disk structure. In this way,'s scripts won't be able to snoop through's files.

Is this possible at all?

(I don't mind using PHP's Safe Mode at all if required)

Thank you.
Who is Participating?
Alf666Connect With a Mentor Commented:
Yep. You have to use safe_mode.

safe_mode = on

Then in your <VirtualHost>:

php_admin_flag engine on
php_admin_value open_basedir "/<whatever>/"

This makes /tmp a common storing place.

You you could also have a tmp directory in each of your domains tree.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.