Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

paths for a dynamic page ?

Status
Not open for further replies.

pnandrus

Programmer
Jul 28, 2004
12
US
I am trying to learn PERL. I am doing pretty good, but i am a bit stuck.
OK, so i have my apache installed in the directory:
C:\Program Files\Apache Group\Apache2
i have my cgi-bin directory set up in this folder to be my cgi directory. So, my PERL script is supposed to take in (through QUERY_STRING) the name of a folder that sits in the DOCUMENT_ROOT, (like photos, family, kids...etc) in each of those folders are different photos. I want the script to output an html file that has links to all those photos. The script is executed via an href link from the DOCUMENT_ROOT directory (htdocs).

For example, I could have a folder named family in htdocs with 10 family photos and executing the script would give me back an HTML page with links to it. I am doing this so my wife will be able to just drop photos in that folder without having to create links manually.

Anyways, (sorry this is so long), when i create the links they are right if the webpage was being considered from DOCUMENT_ROOT, but it seems the webpage is being looked at from the 'cgi-bin' directory because i always get the 'cannot find /cgi-bin/photos/us.jpg message (where us.jpg is in the photos folder which sits in 'htdocs'). How can i output my path so a script executed from cgi-bin will understand where/how to link to these pictures correctly? thanks!
 
you are using relative paths instead of explicit ones I think. For example, if I have a script called test.pl.....located in $DOCUMENT_ROOT/cgi-bin, to access a object relative to the document root, the link would have to start with / in the link, other wise, it tries to access the link below the relative working directory....in this case, cgi-bin. use "/photos/" in your link instead of "photos/"

___________________________________
[morse]--... ...--[/morse], Eric.
 
OK, OK, OK....
i think i get it now. the problem is that i have 2 paths: one for the directory to open and check, the other for where apache links to. I thought that since they are the same directory, both could be expressed the same but i guess apache sees '/photos' as a folder 'photos' in the $DOCUMENT_ROOT dir while the opendir command sees /photos as c:/photos (assuming i am on the c: drive. Is that right? Thanks for the help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top