Re: PHP unlink Permission Error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2009-01-13 at 09:42 -0500, Alice Wei wrote:
> Hi, 
>  
>    I have a snippet of code as follows:
>  
> <?php
>  
> ini_set('display_errors', 1); error_reporting(E_ALL);
> $curDir = getcwd();
> echo $curDir;
> chmod($curDir,0777);
> unlink("testFile.txt");
> echo unlink("testFile.txt");  
> chmod ($curDir,0755);
> ?> 
>  
> The problem is that I do not seem to have the correct permissions, even though I seem to have changed the permissions of the folder to 777 already upon the file deletion time. This is the output I got:
>  
> C:\Inetpub\wwwroot\projectWarning: unlink(testFile.txt) [function.unlink]: Permission denied in C:\Inetpub\wwwroot\project\file_write.php on line 9Warning: unlink(testFile.txt) [function.unlink]: Permission denied in C:\Inetpub\wwwrootproject\file_write.php on line 10
>  
> Could anyone give me some tips on how to resolve this error? Thanks in advance.
>  
> Alice
> _________________________________________________________________
> All-in-one security and maintenance for your PC.  Get a free 90-day trial!
> http://www.windowsonecare.com/purchase/trial.aspx?sc_cid=wl_wlmail

You're using chmod to modify the permissions of the directory, but do
you actually have permissions to modify the permissions? If not, the
chmod will fail without giving an error, and then your unlink will fail
with an error.


Ash
www.ashleysheridan.co.uk


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux