Listing directory for php

Discussion in 'Mac Programming' started by gustavopi, Sep 21, 2013.

  1. macrumors member

    Joined:
    Oct 29, 2008
    #1
    Hi. I'm trying to make a simple photo listing app for my intranet using php. My photos are in an external HD mounted as a Volume, so no permission issues, I can even read those files using simple php file_get_contents function, however, can't obtain a file listing and subdirectories.

    I'm using my own library to read directories basically using opendir and a pointer and it works fine INSIDE apache's root. Outside, it returns a big nothing, I mean, not even an error, just nothing!

    Any ideas?
     
  2. macrumors member

    ccamelot

    Joined:
    Feb 21, 2010
    Location:
    Swinoujscie, Poland
    #2
    opendir outside server root?

    Hi,

    it should be really simple. For instance make a symlink for your external dir in your server root directory or just use complete path eg. "/Volumes/Your Externall HDD/Your Folder/...". And be sure that the directory (and volume) can be read by _www (apache user). Or try to run your script from commandline as root (sudo php path_to_your_script.php).

    hope this helps
     
  3. thread starter macrumors member

    Joined:
    Oct 29, 2008
    #3
    I'm using complete path. By your answer, a symlink is interesting but depends on permissions either, right? When I try to add other users by clicking in the "+" button below _www doesn't appears. I guess I'll have to use the Terminal, right?
     

Share This Page