fopen Errors

2011-01-30
2013-05-30
  • Rod McInnes
    Rod McInnes
    2011-01-30

    If you do a Google on the following terms "pgv_counters.txt failed to open stream" you'll find there are a heap of phpGedview sites out there with crashing counters at opening the homepage. 

    I have two sites to which this happens, but more seriously, I have fopen problems with my GEDCOMS which have got to the point where I can't approve any new entries, though my sites still read the databases okay.  

    The typical error reads:

    ERROR 2: fopen(./index/mydb.GED): failed to open stream: Permission denied

    I've trawled through my site online with FTP programs, read the code, but I have no idea what's happening. I've asked my host if they've changed anything, but given how widespread it is, it must be the software, mustn't it?

    The permission on my GEDCOM is 600, and it won't reset to 777 or something more open (if that's what's needed?)

    Ta

    Rod McInnes

     
  • Gerry Kroll
    Gerry Kroll
    2011-01-31

    You've got "ownership" problems that only your server support can resolve.

    For proper operation, PGV requires the "index" and "media" directories to have full read/write/modify (777) permission for the whole world.

    Since this represents a serious security issue, we strongly recommend that the "index" directory be relocated to an area of your server's file space that's not web addressable but can still be accessed by scripts.  A directory parallel to your webroot would be OK. 

    You should, after having relocated the "index" directory and after having ensured that it has full 777 permission, verify that PGV is working.  You need to export the database to a GEDCOM file so that the two are in synch.  When you're satisfied that PGV is working OK, enable the media firewall.  This relocates your media to be outside the web-addressable file space too.

    Note:
    Even when the "index" and "media" directories' contents are no longer accessible from the Web, you still should have the normal "index" and "media" directories, with their 777 permissions (but no contents).

    To relocate the "index" directory, you need to create that new directory first.  It doesn't have to be called "index".  Copy the contents of the original "index" directory to this new one (don't bother with the sub-directories - they're cache files), and then make sure the directory and its contents have 777 permissions.  Next, you need to temporarily give the "config.php" file that 777 permission.  Launch PGV, access the configuration wizard from the Admin menu, and then tell PGV the new location of the "index" directory.  Exit PGV and set the permissions on the "config.php" file to 755.  (644 might work, but some server require the "excute" permission - the "1" bit - to be set.)

    When PGV is working properly with the newly relocated "index" directory, you can empty the old one.  If there are cache files in there, you might have to get your server support to empty that directory for you.

     
  • Gerry Kroll
    Gerry Kroll
    2011-01-31

    Please note:
    This topic should have been posted in the "Help" forum.