fopen function is not working in "W" mode in php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Locked
hardik
Forum Newbie
Posts: 8
Joined: Fri Jun 29, 2007 2:48 am

fopen function is not working in "W" mode in php

Post by hardik »

hai all

when i try create new file using fopen function in php in "W" mode. it dose not create file.

Create test.php file in /var/www/html/ directory on linux machine.

past this simple code:

<?php

$fp = fopen("newfile.file", "w") or die("Couldn't create new file");

?>

through firefox browser run above file:

ip address/test.php

example : 192.168.0.115/test.php

it show Couldn't create new file means not create file.

please any one tell me step how to run this file using browser on linux.

thanks in advance :oops:
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

It's not a browser issue. It's a file permissions issue. Are you sure that PHP has permissions to write to the folder that you're after?
hardik
Forum Newbie
Posts: 8
Joined: Fri Jun 29, 2007 2:48 am

Post by hardik »

ya

my html directory have file permission as 777

how to check the write permission of php

help me.

thanks for your reply
Locked