Forum Moderators: coopster

Message Too Old, No Replies

open_basedir in php.ini

How to set for docroot AND mysql dbs?

         

StupidScript

1:50 am on Jul 6, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'd like to use the
open_basedir
element in the php.in file, as part of my servers' security measures, however I'm having a hard time figuring out how I can:

1) Set the value so that only files in the

document_root
are available; AND

2) Still be able to access my MySQL databases FROM the pages contained in that directory.

It seems that when I set the value of

open_basedir
to my
document_root
directory (and below), it keeps my calls to the databases from executing. Commenting out that element allows db access ... setting it to anything besides a root-ish path either kills the pages or the db calls, depending on the value.

I don't want to set it to

/
in order to access a high enough level for both (
/var/...
for docroot and
/etc/...
to get me into the dbs), as that would be pointless.

Any advice? TIA.

barns101

7:04 pm on Jul 6, 2006 (gmt 0)

10+ Year Member



The open_basedir value on my shared sever is set to "/home/#*$!/public_html" and I am able to access my MySQL database without any problems.

coopster

1:02 pm on Jul 7, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Simply append the other directories to your inclusive list. Under Windows, separate the directories with a semicolon. On all other systems, separate the directories with a colon.

StupidScript

8:35 pm on Jul 10, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Perfect. Thanks, coopster.