tags:

views:

38

answers:

3

Hi

I have a apache dedicated server with lost of websites.

I also have a red5 installation on the server.

What I want to know how to do is perform file functions - specifically unlink() - on files held in the RED5 directory within the root server dir.

I can move files with this:

copy ("http://www.parttimepornstar.com:5080/echo/streams/".$strFilename, $strDestination);

but

unlink("http://www.parttimepornstar.com:5080/echo/streams/".$strFilename);

...won't work...

Any ideas what I'm doing wrong?

Thanks.

A: 

You are addressing the files via HTTP, which you can't use to delete files. You need to specify a filesystem path such as /etc/httpd/sitename/file.php

Pekka
Not entirely true, but the remote server has to be setup to allow it, and it'll almost certainly require HTTP authentication.
Matthew Scharley
+1  A: 

I suspect you need to use absolute file paths rather than urls/relative paths. Also if you want to delete from root dir, you need to specify that too. Try doing something like below:

unlink($_SERVER['DICUMENT_ROOT'] . '/RED5/' . $yourfiles);
Sarfraz
+1  A: 

You need to check the permission of the file that you are trying to delete. Apache should (hopefully) not be running as root and therefore cannot delete any files that it does not have permissions for.

You should also be vary wary of security. Allowing an unchecked variable to be used in the end of a copy() or unlink() call could potentially give a user access to your entire filesystem. Take a look at basename.

Tom