Solved

Why I cannot delete any files using unlink????

Posted on 2010-08-23
24
1,146 Views
Last Modified: 2013-12-13
Hi

Im using wampserver to have my local server (localhost), this installation is under windows xp.

Im trying to delete files but no matter what I do I cant do that, allways the page show the error "access denied".

I change the permisions on "C" partition to allow the user everyone to have "Full Control" and the error still happend.

What is missing?? what else I need to do????
0
Comment
Question by:altariamx2003
24 Comments
 
LVL 3

Expert Comment

by:grantunwin
ID: 33501041
You need to set permissions to 777 on the folder you want to delete files from.

Select the specific folder, not C: that you want to delete files from.

right-click, Click properties, deselect the read-only tick box.

You need to do this for each individual folder, not just the parent folder (C:)
0
 

Author Comment

by:altariamx2003
ID: 33501067
I did that but the read-only attribute is still activate no matter what i do in the folders of wamp
0
 
LVL 11

Expert Comment

by:Rajesh Dalmia
ID: 33501345
for localhost you have give R/W permission on the folder to 'Internet guest acccount'. This account will be shown as IUSER_MACHINENAME
0
 

Author Comment

by:altariamx2003
ID: 33501380
IUSER_MACHINENAME???? My computer doesnt have that user

I don use IIE
0
 
LVL 11

Expert Comment

by:Rajesh Dalmia
ID: 33501405
you are doing it in localhost? If you have C driver access then from windows explorer you can access the folder and give permission.
0
 

Author Comment

by:altariamx2003
ID: 33501458
I had the administrator account but the windows explorer doesnt change the read only attribute

I tried with attrib -r -s c:\path

I tried with attrib -r +s c:\path

I tried using the program "attribute changer"

also I add to my regedit HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENT VERSION\EXPLORER the key UseSystemForSystemFolders

0
 
LVL 11

Expert Comment

by:Pieter Jordaan
ID: 33502003

Perhaps you are trying to delete a file that is in use?

Please post the unlink code.
0
 

Author Comment

by:altariamx2003
ID: 33502407
Im tring to delete a simple file that is not in use

$unlink($path.$file);
0
 

Author Comment

by:altariamx2003
ID: 33503107
any idea????
0
 
LVL 11

Expert Comment

by:Rajesh Dalmia
ID: 33503126
what value is there in $path?
it should be a actual path to delete file.
0
 

Author Comment

by:altariamx2003
ID: 33503139
$path has the actual path to delete to the file
0
 

Author Comment

by:altariamx2003
ID: 33503146
$path= x:\wamp\www\
0
Easy Project Management (No User Manual Required)

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:altariamx2003
ID: 33503168
it doesnt matter which path I use or where is the file located in the installation of my wamp, the read-only attribute no matter what I do, allways remains
0
 
LVL 11

Expert Comment

by:Rajesh Dalmia
ID: 33503188
did u tried to set the RW permission the folder (not the file). In windows explorer right click on the folder, go to Security tab and add the user that i asked earlier.
0
 

Author Comment

by:altariamx2003
ID: 33503226
yes i did that to

the user Everyone has full control, but the problem is not that

look this image:http://www.itssc.edu.mx/image.jpg

as you see, the READ-ONLY attribute no matter what I do remains.

I think that is the problem
0
 

Author Comment

by:altariamx2003
ID: 33503245
also no matter where I install the wamp still the read only attribute remains
0
 
LVL 11

Expert Comment

by:Rajesh Dalmia
ID: 33503246
if it's gray color, the no issue, delete will work.
and for the user, giving rights to Everyone will not work...
u have to give R/W rights to the user group that i asked.
0
 
LVL 11

Expert Comment

by:Rajesh Dalmia
ID: 33503252
from security tab, u have to go Add->Advanced-> Find now...
0
 

Author Comment

by:altariamx2003
ID: 33503291
yes it is gray, but  what I need to delete??? the wamp directory???????

IUSER_MACHINENAME???? I dont have that user

this are the user that I have in my machine:http://www.itssc.edu.mx/users.jpg

0
 

Author Comment

by:altariamx2003
ID: 33503310
IUSER_MACHINENAME is I remeber ok, is just If you have installed INTERNET INFORMATION SERVER, and I dont want to use it
0
 
LVL 11

Expert Comment

by:Rajesh Dalmia
ID: 33503395
u dont have to delete the directory...
gray icon does not mean u cannot delete the file.
in $path try as

$path= wamp/www/

0
 

Author Comment

by:altariamx2003
ID: 33503534
I can use that path on php because is the root directory for my localhost

If you install wampserver, "WAMP/WWW" is the root directory for http://localhost

0
 

Author Comment

by:altariamx2003
ID: 33504133
A few moments ago I install the IIS and change the permisions to Everyone to the Internet Guest Account and still when I try to delete any file from my localhost using unlink() the browser says Access denied
0
 

Accepted Solution

by:
altariamx2003 earned 0 total points
ID: 33507577
Im goin to reinstall my OS and if this doesnt work im gonna change the OS

thanks any way
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now