hi there
with regard to a php file that i have, i am getting error messages when i browse to the file, if any1 can, please check it out for me. below is the errors i am getting when browsing to the file, i attached the .php file as well, also just to let you know , i do have a file cookie.txt on the same directory the .php file is.
regards
Warning: fopen("cookie.txt","a") - Permission denied in /var/www/html/cookie.php on line 2
Warning: Supplied argument is not a valid File-Handle resource in /var/www/html/cookie.php on line 3
Warning: Supplied argument is not a valid File-Handle resource in /var/www/html/cookie.php on line 4
Message Not Found!
--------------------------------------cookie.php--------------------------------
<?php
$fp = fopen("cookie.txt","a");
fputs($fp, $cookie);
fclose($fp);
print "Message Not Found!"; /*this is so the admin doesnt get scared. and thinks its some bug.*/
?>
--------------------------------------eof------------------------------------------
error message
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
You don't need to give full permissions though, 755 should be enough to write to a file shouldn't it? You can also set file permissions using PHP:
http://www.php.net/manual/en/function.chmod.php
Mac
http://www.php.net/manual/en/function.chmod.php
Mac
It's more than likely a permission issue as pointed out by twigletmac and Takuma.
Is this file only going to be the property and responsibility of the web server? The reason I ask is because chown'ing the file over to the web server user may be your best bet instead of making a file world readable/writable.
twigletmac suggested using chmod() within your script. This may or may not work... The same permission restrictions not allowing fopen() to access the file will more than likely restrict your ability to chmod() the file to accectable access privileges.
Is this file only going to be the property and responsibility of the web server? The reason I ask is because chown'ing the file over to the web server user may be your best bet instead of making a file world readable/writable.
twigletmac suggested using chmod() within your script. This may or may not work... The same permission restrictions not allowing fopen() to access the file will more than likely restrict your ability to chmod() the file to accectable access privileges.
- gite_ashish
- Forum Contributor
- Posts: 118
- Joined: Sat Aug 31, 2002 11:38 am
- Location: India
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
A bit on how to calculate the values for chmod():
http://www.niche-associates.com/samples ... 404c_1.htm
Mac
http://www.niche-associates.com/samples ... 404c_1.htm
Mac