Page 1 of 1

create a file with fopen()

Posted: Mon Dec 27, 2004 6:59 pm
by HormonX
Damn .. am confused ... am trying to create a file and put it in a directory using fopen(). This is what am doing ...

Code: Select all

$fd = fopen('/home/domain/public_html/new/pages/' . $menu_url , 'w+');
where $menu_url is a filename entered by the user. What i get in return when i try to submit a for is this ...


Warning: fopen(/home/domain/public_html/new/pages/test.php): failed to open stream: Permission denied in /home/domain/public_html/new/htmle/secure/newpage.php on line 53


i have looked and tried everything and still nothing...

I have checked the permition on the server and the folder pages is chmod 755 .... am confused ... help

Greg

Posted: Mon Dec 27, 2004 7:48 pm
by scorphus
The folder has to be writeable to the webserver user (nobody, www-data depending on distro). Either you:

- chown the folder to the webserver user or
- chgrp the folder to the webserver group and chmod it 775 (which I believe is the best choice) or
- chmod it 777.

-- Scorphus