Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
February 26, 2007, 4:13 pm
rate this thread
up until now I have used PHP4 as an Apache module which works lovely.
I used to have the following line per VHost for a userdir:
php_admin_value open_basedir /var/www/user/
This allowed users to only browse/open their own dir. Also I had a
couple of open_basedir entries in my global php.ini file like /tmp for
instance. So users could both open /tmp and /var/www/user?
Now I have switched to PHP5 as a CGI and I can't use the
"php_admin_value" settings anymore since running PHP as a CGI works
This however causes a problem for me: how do I set the specific
open_basedir per user?
I can't put the entries in the global php.ini because _all_ users will
be able to use this. So what I'd need is a way to use
a.) either a specific php.ini file per user. But how does this work:
I've tried putting a php.ini in the DocumentRoot -> no effect.
b.) Rewrite the php.ini on the fly somehow, to add the userdir to the
list op open_basedir values when the PHP CGI is invoked.
c.) You tell me...
Any good pointers would be appreciated.
Re: PHP5 as a CGI: how to set OPEN_BASEDIR per user using PHP.INI
Well just to reply to myself: I think I might have found something
The use of the "SetEnv PHPRC /var/www/user" in a .htaccess might help
me to set the PHP runtime environment and thus being able to choose
the location of the the php.ini file (which will allow me to use
different php.ini files).
However this doesnt seem to work for me in PHP 5.2.1. I can see with
phpinfo(); that my PHPRC is set/changed. However the php.ini from this
dir is _not_ picked up... it is still the default location. I don't
Other than this I know my own hosting provider (one.com) is able to
use a specific php.ini file for me _without_ using the PHPRC option.
This much becomes clear from the phpinfo(); So there is another way to
do this; but how?