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

Home Posts Topics Members FAQ

rename, unlink : Permission denied XPpro, Apache, PHP 4.3.3

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);

if (!rename($XMLPa th.$file, $XMLPath.$succe sspath.$file)) //move file in
success path
if(!rename($XML Path.$file, $XMLPath."file. old")){
if (copy($XMLPath. $file, $XMLPath.$succe sspath.$file))
unlink($XMLPath .$file);
}

both Rename and unlink give me Permission Denied error. The file isn't in
read only mode, and the copy works fine (so the path are right...)

Any idea ?

Jul 17 '05 #1
1 3718
Have you tired simplifying your code?

eg, just write a script that says:

unlink ("file.txt") ; just wondering if you are specifying the file properly.

J.
Bob Bedford wrote:
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);

if (!rename($XMLPa th.$file, $XMLPath.$succe sspath.$file)) //move file in
success path
if(!rename($XML Path.$file, $XMLPath."file. old")){
if (copy($XMLPath. $file, $XMLPath.$succe sspath.$file))
unlink($XMLPath .$file);
}

both Rename and unlink give me Permission Denied error. The file isn't in
read only mode, and the copy works fine (so the path are right...)

Any idea ?


Jul 17 '05 #2

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

Similar topics

4
14560
by: lawrence | last post by:
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/publicdomainsoftware.org/htdocs/ppUtilityCode/mcAdminImages.php on line 254 I don't get it. If PHP uploads the file, how can PHP not have the
5
6463
by: Phil Powell | last post by:
print_r(is_file("$logPath/$logFileName")); // RETURNS 1 unlink("$logPath/$logFileName"); // RETURNS WARNING: PERMISSION DENIED This code should tell me that the file located at $logPath/$logFileName should delete the log file, however, it never deletes it due to permissions error. However, upon checking the file properties I find this:
10
7583
by: lorenzogordon | last post by:
Hi there, I'd greatly appreciate any insights into the following problem: I've got PHP running fine on IIS (OS: Server 2003, SP1; IIS: 6.0; PHP: 4.3.11). In PHP, the user uploads a file, which is then processed and the contents are inserted into a new file, created in PHP, onto the server.
4
9781
by: Russell Warren | last post by:
I've been having a hard time tracking down a very intermittent problem where I get a "permission denied" error when trying to rename a file to something that has just been deleted (on win32). The code snippet that gets repeatedly called is here: ... if os.path.exists(oldPath): os.remove(oldPath) os.rename(newPath, oldPath)
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
4
12820
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...
1
3555
by: doctorhardik | last post by:
other interesting thing i observe during my work which i describe below: i am using dotproject2.0.4 on fc3. it is working fine. but i want to generate pdf file report during this time i face permission denied problem. Warning: fopen(/var/www/html/dotproject/files/temp/temp1.pdf): failed to open stream: Permission denied in /var/www/html/dotproject/modules/projects/reports/tasklogs.php on line 307 Could not open file to save PDF. ...
0
6849
by: phil469 | last post by:
I'm having an issue when trying to read a file in a user's homedir from a cgi script. I have a virtual host section in my httpd.conf file which I'll include. The cgi script is a very basic script written in Perl just for testing. I believe I need to find the correct <Directory> entry or some other Directive in Apache to make this work, but I've had no luck for a week now. I've tried many different things, but w/ no luck. I even tried adding...
11
4457
by: byteoart | last post by:
I'm a newbie to php. I am trying to delete a file from the server that I put there (one file, not the whole directory). I am using unlink ($filename); I did the path as a relative path as follows: .../images/6/image_001.JPG I did a scandir $files = scandir("../images/6"); The print_r ($files); shows that the file is one of the files present.
0
8685
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
8493
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
7176
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...
1
6112
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5570
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
4084
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...
1
2613
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
1797
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1493
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.