473,624 Members | 2,346 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

permission error on unlink, but who has permission if not PHP?

I wrote some code that let me upload a file to my server. Then I wrote
some code to let me delete the file. But when I try to delete, I get
this error:

Warning: Unlink failed (Permission denied) in
/usr/local/www/vhosts/publicdomainsof tware.org/htdocs/ppUtilityCode/mcAdminImages.p hp
on line 254
I don't get it. If PHP uploads the file, how can PHP not have the
permission to delete it?
Jul 17 '05 #1
4 14559
"lawrence" a écrit le 17/11/2003 :
I wrote some code that let me upload a file to my server. Then I wrote
some code to let me delete the file. But when I try to delete, I get
this error:

Warning: Unlink failed (Permission denied) in
/usr/local/www/vhosts/publicdomainsof tware.org/htdocs/ppUtilityCode/mcAdminImages.p hp
on line 254
I don't get it. If PHP uploads the file, how can PHP not have the
permission to delete it?


Change the rights with chmod(777) before deleting.
Jul 17 '05 #2
Jedi121 wrote:

I don't get it. If PHP uploads the file, how can PHP not have the
permission to delete it?


Change the rights with chmod(777) before deleting.


Also, output the name of the file you're trying to delete, so that
you can make sure it's really what you think it is...

It may be that you're trying to delete a directory that the webserver
process doesn't own, etc,
Jul 17 '05 #3
lk******@geocit ies.com (lawrence) wrote in message news:<da******* *************** ****@posting.go ogle.com>...
I wrote some code that let me upload a file to my server. Then I wrote
some code to let me delete the file. But when I try to delete, I get
this error:

Warning: Unlink failed (Permission denied) in
/usr/local/www/vhosts/publicdomainsof tware.org/htdocs/ppUtilityCode/mcAdminImages.p hp
on line 254
I don't get it. If PHP uploads the file, how can PHP not have the
permission to delete it?


If the file name you uploaded already existed on the web server and
the web server user (apache?) has write permissions to the file, it
will be allowed.

To unlink, the web server user must have write permissions to the
directory.

Conversely, if a user has write permissions to a directory, it may
delete files from that directory regardless of who owns them...

Hope this helps,

Kevin
Jul 17 '05 #4
lk******@geocit ies.com (lawrence) wrote in message news:<da******* *************** ****@posting.go ogle.com>...
I wrote some code that let me upload a file to my server. Then I wrote
some code to let me delete the file. But when I try to delete, I get
this error:

Warning: Unlink failed (Permission denied) in
/usr/local/www/vhosts/publicdomainsof tware.org/htdocs/ppUtilityCode/mcAdminImages.p hp
on line 254
I don't get it. If PHP uploads the file, how can PHP not have the
permission to delete it?


Well, okay, what I get from this debate is that the first place I
should look for trouble is to make sure the code is trying to delete
the same file I think I specified. I appreciate feedback that tells
where to look for me trouble, so thanks.
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4161
by: JaazzMan | last post by:
Hi! I wrote this script and executed on my server, with php 4.1.2 <?php $fp = fopen('test.txt', 'w'); fwrite($fp, "Bla bla"); fclose($fp); ?> it returns this message:
1
3718
by: Bob Bedford | last post by:
I've tried everything seen on Internet, but nothing works: I'm trying to move a file from a dir to a subdir (WinXP Pro, Apache, PHP 4.3.3) Here is the code: chmod($XMLPath, 0777); chmod($XMLPath.$file, 0777); chmod($XMLPath.$successpath, 0777);
7
13960
by: Stéphane Ninin | last post by:
Hello world, I am fighting with what is probably a stupid problem. In a wxpython GUI, here is a method which must read a file, and if the file is not correctly formed rename it and create a new file: (I have removed most of the logic of the code here, so I am not sure it's going to be helpful)
6
16763
by: Benjamin | last post by:
Hello, I'm running PHP 5.2.0 as a Apache 2.2 server module. When, I try to unlink I get this: "Warning: unlink(file.txt) : Permission denied..." What and how do I change this so it works? Thanks
2
5315
by: f rom | last post by:
----- Forwarded Message ---- From: Josiah Carlson <jcarlson@uci.edu> To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org Sent: Monday, December 4, 2006 10:03:28 PM Subject: Re: 1>make_buildinfo.obj : error LNK2019: unresolved external symbol __imp__RegQueryValueExA@24 referenced in function _make_buildinfo2 Ask on python-list@python.org . - Josiah
4
12819
by: nitinpatel1117 | last post by:
Hi I am trying to delete a csv file using the unlink() function, but i keep getting a permission denied warning Warning: unlink(UsedNOS200704191.CSV): Permission denied in E:\webroot\dev\file_test\index.php on line 416 My script basically reads email attachments and downloads the attachment file into the current directory of the running script. The data in the attachements is then read and stored into MySQL. Once i've finished reading...
4
2408
by: srini4vasan | last post by:
Hi, I wrote a small socket program in C++ using unix machine. Compiler CC. It is asking some library file or linker file Could you please send the library files or linker files for following program. error:
3
2108
by: webandwe | last post by:
Hi, the following coding is and the whole of the admin, it uploads images you select to the folder called images: But the problem is is sets the images permissions to 600 and I need them to be 644 in order to work, I tried to set them but can't get it to work... Example uploadpath/$folder",0644; But it does not work please help...
15
3751
by: Morteneistrom | last post by:
Im a complete n00b at PHP so please forgive me if this i a stupid question Why wont the following work. PHP Code: <?php foreach (glob('../images/profil/*.jpg') as $filename) { echo "$filename <br>". "<a href="unlink('$filename');">Delete</ a>";
0
8233
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8170
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8619
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8334
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8474
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7158
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5561
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2604
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1784
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.