Forum Moderators: coopster

Message Too Old, No Replies

generate static html

create file fails if subfolder

         

jamie

8:19 am on Jan 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



hi,

i am using the following code to generate static html pages in the /static_html/ folder.

// write to static_html
$data = $complete_page;
$file = $include_path . 'htdocs/static_html' . $static_page;
if (!$file_handle = fopen($file,"a")) {
exit("Cannot open file");
}
if (!fwrite($file_handle, $data)) {
exit("write to file");
}
fclose($file_handle);

static_html is owned by nobody.nobody and is chmod 755.

single path files are generated perfectly - e.g. /mypage.html.

but when i try to generate /subfolder/mypage.html it dies with error message saying Warning: No such file or directory

i have tried chmod 777 but still doesn't work.

should i create these directories manually beforehand? or is there a way around?

many thanks!

(edited for clarity)

johannes

9:34 am on Jan 15, 2004 (gmt 0)

10+ Year Member



You'll nedd to create the directory beforehand. Try mkdir()

jetboy_70

11:37 am on Jan 15, 2004 (gmt 0)

10+ Year Member



Also worthwhile finding out if your host has PHP safe mode switched on, which disables directory writing for 'security' reasons.

jamie

11:44 am on Jan 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



thanks johannes!

great help. i can now loop through creating as many subdirectories as needed according to my script_url

cheers

p.s. jetboy - it's our own server, but thanks for input :-)