 |
 |
php fopen(), permission denied
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: May 2002
Location: Ft Lauderdale
Status:
Offline
|
|
Anyone know what might cause a permission denied error on fopen()?
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">if (!($file = fopen("filename.html", "w"  )) die("Error."  ;</pre><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">The file does not exist, if I create it manually I still get the error.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Jul 2002
Location: Leiden, Netherlands
Status:
Offline
|
|
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">quote:</font><hr /><font size="1" face="Geneva, Verdana, Arial, sans-serif">Originally posted by Vasudevelopa:
<strong>Anyone know what might cause a permission denied error on fopen()?
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">if (!($file = fopen("filename.html", "w"  )) die("Error."  ;</pre><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">The file does not exist, if I create it manually I still get the error.</strong></font><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">What do you have when you do a ls -l filename in the terminal ?
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: May 2001
Location: Nottingham, UK
Status:
Offline
|
|
does the process have write/execute permissions on the directory that the file is in?
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: May 2002
Location: Ft Lauderdale
Status:
Offline
|
|
ls -l gives -rw-r--r-- and staff as owner. I chmod 777 and it wrote the file. The problem is +w should create the file if it doesn't exist, which is what I need. So I can't give write permissions to the file if it doesn't exist yet.
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">quote:</font><hr /><font size="1" face="Geneva, Verdana, Arial, sans-serif">does the process have write/execute permissions on the directory that the file is in? </font><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">How would I give permissions to the process?
|
|
|
| |
|
|
|
 |
|
 |
|
Grizzled Veteran
Join Date: Jun 2001
Location: Melbourne, Australia
Status:
Offline
|
|
You don't give permissions to the process - you give it to the parent folder of the directory you want to write into.
Go into terminal, type:
sudo chmod 755 /path/to/your/directory
Enter your password and you've got updated permissions.
Note that I ran into some trouble with my ISP when I tried the same. It seems that the user I was FTPing the files with caused problems with permissions - I ended up using a chmod 777 to get it to work (which is a BAD thing!). To keep it more secure, though, I relocated that folder outside the document root so there was no public access to it.
|
|
Computer thez nohhh...
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|