473,692 Members | 2,216 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Permission problems with unlink()

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 ) [function.unlink]:
Permission denied..." What and how do I change this so it works?
Thanks

Aug 19 '06 #1
6 16769
This could be a permission issue. To unlink a file your webserver must
have the permissions to remove it. Most likely your apache is running
as user 'apache', so the file you are removing must either be owned by
user/group apache, or have permissions to be removed by any user (666 /
777).

Terence

Benjamin wrote:
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 ) [function.unlink]:
Permission denied..." What and how do I change this so it works?
Thanks
Aug 19 '06 #2
I'm sorry I forgot to mention that I'm running windows.

te************@ gmail.com wrote:
This could be a permission issue. To unlink a file your webserver must
have the permissions to remove it. Most likely your apache is running
as user 'apache', so the file you are removing must either be owned by
user/group apache, or have permissions to be removed by any user (666 /
777).

Terence

Benjamin wrote:
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 ) [function.unlink]:
Permission denied..." What and how do I change this so it works?
Thanks
Aug 19 '06 #3
*** Benjamin escribió/wrote (19 Aug 2006 11:04:15 -0700):
I'm sorry I forgot to mention that I'm running windows.
Then right click on the icon in Windows explorer, select "Properties ", find
the "Security" tab and set permissions accordingly.

>This could be a permission issue. To unlink a file your webserver must
have the permissions to remove it. Most likely your apache is running
as user 'apache', so the file you are removing must either be owned by
user/group apache, or have permissions to be removed by any user (666 /
777).

--
-+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web: http://bits.demogracia.com
+- Mi web de humor con rayos UVA: http://www.demogracia.com
--
Aug 22 '06 #4
I figured it out. It was stupid really. I had opened the file with
fopen() without running fclose() before trying to unlink() it. Thanks
for your help though.
Alvaro G. Vicario wrote:
*** Benjamin escribió/wrote (19 Aug 2006 11:04:15 -0700):
I'm sorry I forgot to mention that I'm running windows.

Then right click on the icon in Windows explorer, select "Properties ", find
the "Security" tab and set permissions accordingly.

This could be a permission issue. To unlink a file your webserver must
have the permissions to remove it. Most likely your apache is running
as user 'apache', so the file you are removing must either be owned by
user/group apache, or have permissions to be removed by any user (666 /
777).


--
-+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web: http://bits.demogracia.com
+- Mi web de humor con rayos UVA: http://www.demogracia.com
--
Aug 24 '06 #5
Benjamin wrote:
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 ) [function.unlink]:
Permission denied..." What and how do I change this so it works?
Thanks
Does this happen on PHP 5.1? It may be a PHP5.2 bug, in which case you
should report it.

We need to see some code first, but my guess is that you do not have
permission to delete that file. What is the file CHMOD'd to? Can you
delete it via the command line?

Also, if you unlink something at script shut down (__destruct() for
example), you will run into problems with permissions, because the
engine is in the processing of shutting down and many streams are killed
-- such as MySQL, and likely the filesystem.

Carl
--
Carl Vondrick
www.YoungCoders.com -- Forum for the younger, next generation programmers.
Sep 29 '06 #6
It was totally my fault.
I had created the file with fopen and failed to call fclose before
trying to delete it. I suppose that fopen had use of the file so I
couldn't alter it.
Carl Vondrick wrote:
Benjamin wrote:
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 ) [function.unlink]:
Permission denied..." What and how do I change this so it works?
Thanks

Does this happen on PHP 5.1? It may be a PHP5.2 bug, in which case you
should report it.

We need to see some code first, but my guess is that you do not have
permission to delete that file. What is the file CHMOD'd to? Can you
delete it via the command line?

Also, if you unlink something at script shut down (__destruct() for
example), you will run into problems with permissions, because the
engine is in the processing of shutting down and many streams are killed
-- such as MySQL, and likely the filesystem.

Carl
--
Carl Vondrick
www.YoungCoders.com -- Forum for the younger, next generation programmers.
Sep 29 '06 #7

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

Similar topics

0
1238
by: Nick Zdunic | last post by:
I have this code which throws up an error on my box (Windows Sever 2003 - Enterprise Edition) MsgBox("Message", MsgBoxStyle.Question OrMsgBoxStyle.MsgBoxSetForeground, "Title") I have tried using this code and still it wont work: Dim permSet As New PermissionSet(PermissionState.None) permSet.AddPermission(New UIPermission(UIPermissionWindow.AllWindows))
1
1434
by: www.douglassdavis.com | last post by:
I screwed up the permissions on my database. Basically I revoked all the permissions of the root account on the mysql table. To try to fix this, I went through all of the instructions here: http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html running: mysqld-nt.exe --defaults-file="C:\Program Files\MySQL\MySQL Server 5.0\my.ini" --init-file=C:\mysql-init.txt
4
2251
by: Marcin Zmyslowski | last post by:
Hello! I have a few tables in MS SQL Server 2000, where I have admin permissions for these tables. I have created a blank database in MS Access 2003, where I linked a table from MS SQL Server 2000. The problems is that I have only read permissions on these tables in MS Access 2003, while I have admin permissions in MS SQL Server 2000. Is it possible to have the sime permission in both MS Access 2003 and MS SQL Server 2000? Is it...
7
8081
by: Jerome Lyles | last post by:
I'm trying to build a database. But none of the users I try to use works. I as normal user doesn't work: :~> createdb mydb createdb: could not connect to database template1: FATAL: user "adriel" does not exist I as postgresql user doesn't work: :~> createdb mydb createdb: could not connect to database template1: FATAL: user "mypostgre"
15
1944
by: sflynn | last post by:
I've just created a new program in Visual Studio 2005, Visual Basic. I can publish, install, and run the program just fine as long as the user is a member of the "Domain Admins" group. My problem is when a non-admin using tries to run the program. The program gets hung up on the following line Dim cn As System.Data.SqlClient.SqlConnection = New SqlConnection("Data Source=spdb01;Initial Catalog=SToP;Integrated Security=True;") How...
0
1707
by: neoret | last post by:
Hello. I have developed an application (an office addin).The application works fine with no error messages on my devoping machine (that machine is not connected to any domains). I have problems getting this application to run on a computer where the user is on a domain (as in a big company where you log on to the company domain).
10
2938
Mague
by: Mague | last post by:
Hey, I am using a server of my friends, and i created a directory through php with exec("mkdir $dir") these are now imposible to get into and delete. (well not impsobile, impossible for a kid my age who doesnt no what they have done) It says permission denied i use smartftp and that covers everything i tihnk.has this happened to anyone before and know how to fix it! Thanks alot mague
5
7059
by: sayeo87 | last post by:
Hi, I am quite new to JSP so please forgive me if I ask really simple things... I am trying to run system commands on the server and display the output on a webpage. This is what I've got: <%@ page import="java.io.*" %> <HTML> <BODY> <% Runtime rt = Runtime.getRuntime(); Process p = rt.exec("/bin/ls");
0
8604
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
9083
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8961
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
8800
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
8801
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
5819
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();...
0
4324
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4557
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2238
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.