Welcome to WebmasterWorld Guest from 184.108.40.206 , register , free tools , login , search , pro membership , help , library , announcements , recent posts , open posts Become a Pro Member
open a new file open a new file xbl01234
Hello; I am trying to open a new file, but it give me the following massage, could anyone help, please.
Warning: fopen(testFile.php) [function.fopen]: failed to open stream: Permission denied in index.php on line 3
can't open file
$ourFileName = "testFile.php"; $ourFileHandle = fopen($ourFileName, 'w') or die("can't open file"); fclose($ourFileHandle); ?>
have you checked the folder permissions (where the file is)?
If they are set in a wrong way, php won't be able to create/open your file. Concult your manual for chmod() for start.
smells so good
Sure. The message you received is exactly what is coded into your php script. In fact, your php code is working perfectly. That's the good news. Now you need to set your file permissions. A little more info about the environment will be helpful. What OS are you running this script on?
Thanks for you both;
>What OS are you running this script on?
I am hosting now. I think the web server side use linux. smells so good
You'll need to use chmod [ us2.php.net], on the file and/or file directory. I was looking through the library [ webmasterworld.com] for anything about permissions, but nothing stood out.
But it is good to known i need to get a permission to open a new file.
i will try to find these information from google.
Thanks a lot
Hi smells so good,omoutop; Thanks for you both advice, i can create a new file now. Because i am hosting, so i go to set the permission for the file to 740. Then it works.
but you think the value of 740 is enough safty?