By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,016 Members | 1,033 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,016 IT Pros & Developers. It's quick & easy.

permission denied to open dbm

P: n/a
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="fr**@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
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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.

Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.