This is a discussion on permission denied to open dbm within the PHP Language forums, part of the PHP Programming Forums category; I can't open a dbm in my webspace, the message I get is Warning: dba_open(./subscribers.db): failed to ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I can't open a dbm in my webspace, the message I get is
Warning: dba_open(./subscribers.db): failed to open stream: Permission denied in /home/fhlinux199/f/fortunesgreenradio.co.uk/user/htdocs/scripts/footy_subscribers.php on line 15 Couldn't open database The relevant code is ; <?php $name="fred"; $email="fred@frog.com"; function addsubscriber ($name,$email){ $db=dba_open("./subscribers.db","c","db4") or die("Couldn't open database"); if (!dba_exists($name)) dba_insert ($name,$email,$db); dba_close($db); } function listentries(){ $db=dba_open("subscribers.db","r","db4"); $key=dba_firstkey($db); while ($key){ print ("$key : dba_fetch($key)"); $key=dba_nextkey($db); } } addsubscriber ($name,$email); Do dbm files need a suffix (i.e. .db) ? Can anyone help, or is it a permission issue I have to take up with my hosts ? Thank you |
|
|||
|
charlie fortune wrote:
> I can't open a dbm in my webspace, the message I get is > > Warning: dba_open(./subscribers.db): failed to open stream: Permission > denied in > /home/fhlinux199/f/fortunesgreenradio.co.uk/user/htdocs/scripts/footy_subscribers.php > on line 15 Couldn't open database > > The relevant code is ; > <snip> > > Do dbm files need a suffix (i.e. .db) ? Can anyone help, or is it a > permission issue I have to take up with my hosts ? > No. On a Unix system, and even on a Micorosft Windows machine, file extensions are just a convention and do not (AFAIK) affect access rights. The webserver typically runs as a different user on a shared system - usually a user (say web_uid) whom is not allowed to login. Looks like a straight permissions error. Since web_uid cannot write to /home/fhlinux199/f/fortunesgreenradio.co.uk/user/htdocs/scripts/ the sensible thing would be to create a different directory writable by all (as a normal user you can't create a dir only writable by web_uid). If possible I would try to make it outside of the document root so people can't download it. If this is not possible you can protect it using a ..htaccess file, or if this is not practical, default apache configs typically disallow access to files beginning .ht HTH C. |