moose4204l Posted May 9, 2009 Share Posted May 9, 2009 I am creating a PHP page where I need to create a file, the snippet code i am using is $fp = fopen("$DOCUMENT_ROOT/../Adirectory/Afile.txt", 'w' ) but when i run the page, i get a permissions problem. then I chmod'ed the folder to 755 and it didnt work, then I chmod'ed it to 777 and it worked. However, my question is, is this the real way to do it or does that have a security risk involved? Is there a different way I should be doing this? Link to comment https://forums.phpfreaks.com/topic/157446-fopen-permission-problem/ Share on other sites More sharing options...
Presto-X Posted May 9, 2009 Share Posted May 9, 2009 I think you could do somthing like this: chmod("$DOCUMENT_ROOT/../Adirectory/", 7777); $fp = fopen("$DOCUMENT_ROOT/../Adirectory/Afile.txt", 'w' ) chmod("$DOCUMENT_ROOT/../Adirectory/", 0755); Hit up http://us.php.net/chmod for more information about it. Link to comment https://forums.phpfreaks.com/topic/157446-fopen-permission-problem/#findComment-830137 Share on other sites More sharing options...
moose4204l Posted May 9, 2009 Author Share Posted May 9, 2009 cant find answer, anyone know? Link to comment https://forums.phpfreaks.com/topic/157446-fopen-permission-problem/#findComment-830345 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.