permission denied to open dbm

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


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-27-2005
charlie fortune
 
Posts: n/a
Default permission denied to open dbm

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
Reply With Quote
  #2 (permalink)  
Old 04-27-2005
Colin McKinnon
 
Posts: n/a
Default Re: permission denied to open dbm

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.

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 11:12 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0