473,320 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

PHP5 as a CGI: how to set OPEN_BASEDIR per user using PHP.INI

Hi,

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
differently.
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.

Feb 26 '07 #1
1 6793
On Feb 26, 5:13 pm, janvdb...@gmail.com wrote:
Hi,

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
differently.
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.

Well just to reply to myself: I think I might have found something
useful.
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
know why?

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?

Feb 28 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Tim Tyler | last post by:
I'm sure this is a FAQ - but I could not find a coherent statement of the answer: Some of my clients want PHP4. Other ones want PHP5. Can I run both PHP4 and PHP5 under the same instance of...
11
by: neur0maniak | last post by:
Hi, I've been eager to try out PHP5, so I've dumped it on my little dev machine. It's running WinXP with IIS5. I've put the php-cgi.exe in the "mappings" page as I'm used to doing with PHP4....
2
by: Jupiter's Song | last post by:
(In Apache2) I have this setup and using the new CGI daemon interface... no probs. However the binary is accessible via the browser. I suppose I wouldn't even make this an issue but I get this...
2
by: Markus Ernst | last post by:
Hi In my application I have lots of require statements that include files residing in the same directory: index.php requires: require_once($_SERVER."/modules/cms/classes/page.php"); ...
5
by: voronwae | last post by:
Hi folks. Either I'm missing something really obvious (most likely) or I'm missing something really subtle. I've been building up a machine as an IMP webmail server, with php 5.1.2, cyrus-sasl,...
2
by: Stefan Huber | last post by:
Hi I've got a really strange problem, and can't find out why it's not working as intended. in order to use php4 and 5 together on a webserver and the requirement for running as different...
6
by: lawrence k | last post by:
If I ssh to my server and look at the php.ini file, it apears that open_basedir is off: ; open_basedir, if set, limits all file operations to the defined directory ; and below. This directive...
3
by: IamtheEvster | last post by:
Hi there, I'm using fopen for the first time and I know I'm running into a permissions problem, but I can't seem to resolve it and any help would be greatly appreciated. I'm running PHP5 and...
16
LacrosseB0ss
by: LacrosseB0ss | last post by:
I'm currently working on an online directory system using PHP (due to server constraints). Normally I would use something else but c'est la vie! I have my pages on the server (Login.php,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.