Log in

View Full Version : Help with file opening



Objectivity
02-20-2007, 04:46 PM
Can someone tell me if there's an issue with Verio regarding relative links on its servers or if I'm just doing something amazingly stupid.

I'm trying to pull calendar data from a CSV file. My PHP code works on an extra domain that I'm using as a test site through GoDaddy but I'm having no luck using the same file on a Verio server.

The relative link that works on my test site includes the line:
$handle=fopen('calendar/staffCalendar.csv', 'r');

On Verio, that line results in a Can't Open File error.

I've discovered a workaround by using an absolute link, but I'd rather keep it relative. The absolute link that works is:
$handle=fopen('http://www.girlscoutsjs.org/calendar/staffcalendar.csv', 'r');

The file that contains the link is located in the index directory and the calendar directory is immediately off of that.

Thanks for any help that anyone can provide.

Titan85
02-20-2007, 05:10 PM
I think the problem is that the file you are trying to open is not in the same directory. If it is one directory above, the link would be ../staffCalendar.csv. I am not sure where exactly you have the 2 files, but if the file calling staffCalendar.csv is in the index directory and the staffCalandar file is in the /calendar directory, I believe the link should be /calendar/staffCalendar.csv. Hope that helps

Objectivity
02-20-2007, 06:57 PM
I think the problem is that the file you are trying to open is not in the same directory. If it is one directory above, the link would be ../staffCalendar.csv. I am not sure where exactly you have the 2 files, but if the file calling staffCalendar.csv is in the index directory and the staffCalandar file is in the /calendar directory, I believe the link should be /calendar/staffCalendar.csv. Hope that helps

I put everything into the same directory, which works around the issue. I tried all the different variations of the directories without any success. If I can get it working in one directory I'm willing to live with it. Thanks for the help.

The newest issue is that I can't get the file open for writing. I'm using
$handle=fopen('staffcalendar.csv', 'a');

Everything is in the same directory, so I shouldn't need to worry about paths. Since this is working without problem on another server with the same directory structure my only thought is that I need to create a php.ini file and allow fopen to open files for writing. I don't know what the command would beor where php.ini would be saved. php_info tells me that the file is saved in "c:\php\php.ini" but that doesn't do me any good.