Asking this makes me feel sooo new lol...
I'm trying to let php create a "motd" file.
To start doing so, I thougt I should make use of fopen(); with W+ option.
So, if the file don't exsist, it will be created.
But what happens...
permission denial.
Even chmod didnt work.
So I went looking on the web (hey I'm not that new...)
And it says at php.net:
If you are experiencing problems with reading and writing to files and you're using the server module version of PHP, remember to make sure that the files and directories you're using are accessible to the server process.
Unfortunaly, this doesnt tell what I should do when this error is there....well ok, it does, but very minor.
"make sure that the files and directories you're using are accessible to the server process"
This is to cryptic for me..
btw:
safe mode=off
allow_url_fopen=on
open_basedir=off
Also, I have full control of the server.
...what to do now?
I think I should give php the right to create files.
How?
getting fopen to work takes...?
Moderator: General Moderators
- redhair
- Forum Contributor
- Posts: 300
- Joined: Fri May 30, 2003 4:36 pm
- Location: 53.23N-6.57E
- Contact:
error bugger:
Warning: fopen(motd) [function.fopen]: failed to create stream: Permission denied in /var/www/html/motd/index.php on line 5
Warning: fputs(): supplied argument is not a valid stream resource in /var/www/html/motd/index.php on line 7
Warning: fclose(): supplied argument is not a valid stream resource in /var/www/html/motd/index.php on line 8
the code:
It works on my other machine...but not on my linux.
Warning: fopen(motd) [function.fopen]: failed to create stream: Permission denied in /var/www/html/motd/index.php on line 5
Warning: fputs(): supplied argument is not a valid stream resource in /var/www/html/motd/index.php on line 7
Warning: fclose(): supplied argument is not a valid stream resource in /var/www/html/motd/index.php on line 8
the code:
Code: Select all
<?php
$n = "Today's wisdom: php rockes!";
$f = fopen ("motd", "w+");
fputs($f, $n);
fclose($f);
?>