Languages :: PHP :: PHP to access a .htaccess protected folder |
|||
| By: collegeBoy |
Date: 23/03/2003 00:00:00 |
Points: 75 | Status: Answered Quality : Excellent |
|
I made a script that uses the copy() function to upload a file to a directory on the server. The script works just fine when I leave the directory unprotected. However, I have protected the directory with .htpasswd and .htaccess so that the files that are uploaded are not public domain. This makes the PHP script return an error in the browser: Warning: Unable to create '/home/.1qaz/vault/files.url.com/vault/DSCF0025.JPG': Permission denied in /home/.1qaz/vault/files.url.com/index.php on line 11 If I understand this correctly, it means the PHP script has no authority to get around the .htaccess authentication. I would like a way to pass authentication to the directory, or get around the whole authentication process altogether. What would you recommend? |
|||
| By: VGR | Date: 23/03/2003 20:20:00 | Type : Comment |
|
| authorizing the Apache/IIS user to access this directory. OR enable localhost access to it (the server is running locally) |
|||
| By: collegeBoy | Date: 23/03/2003 20:36:00 | Type : Comment |
|
| The server isn't running locally. I simply have an account with a provider. Is this something I can request of the administrators? Would they be willing? :) I suppose I can ask. Thanks! Any other recomendations that I can do without administration help? |
|||
| By: VGR | Date: 23/03/2003 20:50:00 | Type : Answer |
|
| ho, then it's for sure (99%) a problem of access right for you sure : ask the provider for the cause of the error, as I think you're not doing anything forbidden (except if YOU created the directory you try to write in, using FTP for example. Then you should set appropriate permisisons like 777) |
|||
| By: collegeBoy | Date: 23/03/2003 21:02:00 | Type : Comment |
|
| HA! It worked. Thanks VGR, that was great advice. The folder had 666 permissions, instead of 777. :) |
|||
| By: VGR | Date: 23/03/2003 21:18:00 | Type : Comment |
|
| classical :D |
|||
| By: TheFalklands | Date: 23/03/2003 21:27:00 | Type : Comment |
|
For those of you keeping score at home, please note that the copy() function DOES NOT bother to take into account any settings you have in .htaccess . This is applicable to ANY file manipulating function in PHP or otherwise (fopen, fwrite, file, etc). The reason? .htaccess is an APACHE ONLY thing. It is NOT a file control mechanism of the operating system. |
|||
|
Do register to be able to answer |
|||
©2010 These pages are served without commercial sponsorship. (No popup ads, etc...). Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE.
Please DO link to this page!








