At 1:02 AM +0100 6/6/10, Ashley Sheridan wrote:
On Sat, 2010-06-05 at 18:55 -0400, tedd wrote:
Hi gang:
Never-mind.
I didn't change the parent directory permissions to unlink the file -- duh!
tedd
I was just about to mention this! It's one of the bizarre security
loopholes in Linux. If
On Sun, 2010-06-06 at 14:08 -0400, tedd wrote:
At 1:02 AM +0100 6/6/10, Ashley Sheridan wrote:
On Sat, 2010-06-05 at 18:55 -0400, tedd wrote:
Hi gang:
Never-mind.
I didn't change the parent directory permissions to unlink the file -- duh!
tedd
I was just about to mention this!
On 5 June 2010 23:45, tedd t...@sperling.com wrote:
Hi gang:
I use unlink() to delete files on my server by using the statement:
unlink($filename);
where $filename is the physical path to the file plus file name, such as:
$filename = '/var/www/vhosts/domain.com/httpdocs/a-dir/a-text.txt';
On Sat, 2010-06-05 at 18:55 -0400, tedd wrote:
Hi gang:
Never-mind.
I didn't change the parent directory permissions to unlink the file -- duh!
Cheers,
tedd
--- I asked:
Hi gang:
I use unlink() to delete files on my server by using the statement:
unlink($filename);
function saveRecord ($db,$POST) {
$bd = /absolute_path_to_document_root;
$fp = /path_to_files_from_document_root/;
$ud = $bd . $fp;
snip
$path = $ud.$file; // absolute path to newly named file
if ($fail || !$name || !$temp) continue;
//
Did you actually READ my previous post that you replied to?...
On Wed, July 18, 2007 1:29 am, [EMAIL PROTECTED] wrote:
Ok thanks everyone...
I need to throw in a wildcard, how would I do that.. I have this so
far.
which dont work.
?
$filename = '/home/public_html/client/test/*.txt.asc';
))
{
unlink($filename);
unlink($filename2);
}
?
Thankyou
- Original Message -
From: Richard Lynch [EMAIL PROTECTED]
To: Stut [EMAIL PROTECTED]
Cc: Suhas Pharkute [EMAIL PROTECTED]; [EMAIL PROTECTED];
php-general@lists.php.net
Sent: Wednesday, July 18, 2007 2:17 AM
Subject: Re: [PHP
On Wed, 2007-07-18 at 07:29 +0100, [EMAIL PROTECTED] wrote:
I need to throw in a wildcard, how would I do that.. I have this so far.
which dont work.
foreach(glob(*.asc.txt) as $files)
{
unlink($files);
}
--Paul
All Email originating from UWC is covered by disclaimer
On Mon, July 16, 2007 8:40 am, Stut wrote:
Suhas Pharkute wrote:
http://us.php.net/manual/en/function.fileatime.php
$filename = 'somefile.txt';
if (file_exists($filename) fileatime($filename)
(time()-(7*24*60*60)) )
{
unlink($filename);
}
Read docs!
You too! The OP wanted a way
How would I use fileatime to check if the file is older then 7 days?
I have a directory with .txt and .txt.asc files.
What I want to do is..
Check the age of all files ending in .txt.asc
and if the file *.txt.asc is older then 7 days
delete thatfile.txt.asc and also thatfile.txt
--
[EMAIL PROTECTED] wrote:
How would I use fileatime to check if the file is older then 7 days?
You want filemtime not fileatime.
-Stut
--
http://stut.net/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
http://us.php.net/manual/en/function.fileatime.php
$filename = 'somefile.txt';
if (file_exists($filename) fileatime($filename) (time()-(7*24*60*60)) )
{
unlink($filename);
}
Read docs!
Suhas
On 7/16/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
How would I use fileatime to check if
Suhas Pharkute wrote:
http://us.php.net/manual/en/function.fileatime.php
$filename = 'somefile.txt';
if (file_exists($filename) fileatime($filename)
(time()-(7*24*60*60)) )
{
unlink($filename);
}
Read docs!
You too! The OP wanted a way to check the age of all files. The
fileatime
-Original Message-
From: [EMAIL PROTECTED]
To: php-general@lists.php.net
Date: Mon, 16 Jul 2007 14:25:47 +0100
Subject: Re: [PHP] Unlink file older then 7 days
How would I use fileatime to check if the file is older then 7 days?
something like:
$access = fileatime (c:\path
On Saturday 14 July 2007 9:16:06 pm [EMAIL PROTECTED] wrote:
I have a directory with .txt and .txt.asc files.
What I want to do is..
Check the age of all files ending in .txt.asc
and if the file *.txt.asc is older then 7 days
delete thatfile.txt.asc and also thatfile.txt
look at these
Can do, but I would be calling clearstatcache() very often, many
times per second, as often as these graphics are being edited. Would
that still be appropriate for the server?
On Jun 19, 2007, at 8:07 AM, Greg Donald wrote:
On 6/17/07, Brian Dunning [EMAIL PROTECTED] wrote:
If I write an
On 6/20/07, Brian Dunning [EMAIL PROTECTED] wrote:
Can do, but I would be calling clearstatcache() very often, many
times per second, as often as these graphics are being edited. Would
that still be appropriate for the server?
I certainly wouldn't use it if I didn't need it.
--
Greg Donald
On 6/17/07, Brian Dunning [EMAIL PROTECTED] wrote:
If I write an edited image back to disk using imagepng, is it
desirable to first unlink the existing image?
It's not required.
I notice that it works
fine if I don't. Just wondering if there are any pros or cons.
Just be sure and call
Thank you for checking on this.
I am using debain stable with a 2.6.14.3 kernel. The filesystem in
question is ext2 on a 48 MB ramdisk.
I also did the following on another machine using ext2 on a harddisk
with command line php.
I just ran the test with php4 cli and it works correctly.
PHP
On Thu, Dec 22, 2005 at 08:29:53AM -0700, jgmtfia Mr wrote:
Thank you for checking on this.
I am using debain stable with a 2.6.14.3 kernel. The filesystem in
question is ext2 on a 48 MB ramdisk.
I also did the following on another machine using ext2 on a harddisk
with command line
I just ran the test with php4 cli and it works correctly.
PHP 4.3.10-15 (cli) (built: May 9 2005 08:54:56)
But with php5 cli and apache2 module it does not:
PHP 5.1.0b3 (cli) (built: Oct 18 2005 16:13:19)
PHP 5.1.0 apache module
The versions I ran the tests were on:
PHP
On Thu, Dec 22, 2005 at 02:41:40PM -0700, jgmtfia Mr wrote:
I just ran the test with php4 cli and it works correctly.
PHP 4.3.10-15 (cli) (built: May 9 2005 08:54:56)
But with php5 cli and apache2 module it does not:
PHP 5.1.0b3 (cli) (built: Oct 18 2005 16:13:19)
PHP 5.1.0
Be sure to include the OS, filesystem type and the configure line
in the report, cause there seems to be something system dependent
causing it since the script you posted earlier worked fine on my
system.
Thanks for your help. I appreciate it.
--
PHP General Mailing List
On Wed, Dec 21, 2005 at 11:27:23AM -0700, jgmtfia Mr wrote:
I have a directory with the files:
/config/A
/config/B
and
/config/C is a symlink to /config/A.
Via php I unlink /config/C:
$FILE = '/config/C';
while(file_exists($FILE)){
The loop then continues forever with file_exists() returning true, but
unlink() returns false with the error message Warning:
unlink(/config1/C) [function.unlink]: No such file or directory in
/www/script.php on line 10
This might be an issue with the OS or Filessystem. The code
works
PHP has wonderful capabilities to generate images on the fly, such that they
are never stored on disk, perhaps you should look into that as an option,
you could even make the code decide who should be able to see the image and
who should not.
http://www.php.net/manual/en/ref.image.php
Warren
What you may want to try doing is when the script is ran, it goes through a
clean-up function and deletes everything that it doesn't need for the
current execution.
Though, realize that if two people hit a page within a few seconds, you may
end up deleting some images that the first user is
On Saturday 27 November 2004 03:13, Julian wrote:
I would like to delete a set of images right after they are displayed on
the page using unlink.
I'm curious to know why you want this.
Unfortunately, with unlink the images are deleted
before they display on the user's browser. Is there a
Ave,
Nope... Didn't work. Didn't return an error or anything, didn't delete the
folders either!
On 8/23/04 8:21 PM, Richard Whitney [EMAIL PROTECTED] wrote:
Let me clarify:
system() is like working in a shell
rm -rf forces removal of the directory $file_dir, which you define
Ave,
Trust me I do... I double checked it actually..
On 8/24/04 1:41 PM, Richard Whitney [EMAIL PROTECTED] wrote:
Dumb question - are you sure you got the path right?
i.e. /home/public_html/rest/of/your/path
On Tue, 24 Aug 2004 13:31:06 -0400, PHP Junkie [EMAIL PROTECTED] wrote:
Ave,
PHP Junkie wrote:
Ave,
Nope... Didn't work. Didn't return an error or anything, didn't delete the
folders either!
If you cannot delete via the php functions or via system calls, then you
have a permission problem.
What user/group is Apache running as?
What is the output of 'ls -al' for the files
Please do not top post.
On Wednesday 25 August 2004 01:31, PHP Junkie wrote:
Ave,
Nope... Didn't work. Didn't return an error or anything, didn't delete the
folders either!
system('rm -rf',$user_dir,$ret_val);
That should be:
system(rm -rf $user_dir, $ret_val);
--
Jason Wong -
Ave,
Apache to the best of my knowledge runs as nobody by default and since I
didn't change any settings, it is probably running as nobody.
This is what I got with ls -al
rahul:/Library/WebServer/Documents/informed-sources.com/imsafm bob$ ls -al
total 16
drwxrwxrwx5 nobody nobody170 24
PHP Junkie wrote:
Ave,
Apache to the best of my knowledge runs as nobody by default and since I
didn't change any settings, it is probably running as nobody.
This is what I got with ls -al
rahul:/Library/WebServer/Documents/informed-sources.com/imsafm bob$ ls -al
total 16
drwxrwxrwx5 nobody
Ave,
IT WORKS!!!
I guess it was the syntax which was the problem! Finally it works!!
system(rm -rf $user_dir, $ret_val);
Works perfectly... Removes folder!
Thanks a TON!
On 8/24/04 2:04 PM, Jason Wong [EMAIL PROTECTED] wrote:
Please do not top post.
On Wednesday 25 August 2004 01:31,
Ave,
IT WORKS!!!
I guess it was the syntax which was the problem! Finally it works!!
system(rm -rf $user_dir, $ret_val);
Works perfectly... Removes folder!
Thanks a TON!
On 8/24/04 2:04 PM, Jason Wong [EMAIL PROTECTED] wrote:
Please do not top post.
On Wednesday 25 August 2004 01:31,
Please stop top posting.
On Wednesday 25 August 2004 02:20, PHP Junkie wrote:
Apache to the best of my knowledge runs as nobody by default and since I
didn't change any settings, it is probably running as nobody.
Instead of speculating, find out for certain by using phpinfo().
--
Jason Wong
The reason this works is because you are doing a recursive remove of
the directory. The PHP rmdir() does not remove a directory with
contents in it. If you modify your script so that it walks the users
directory and removes each file and subdirectory then it would
probally have worked correctly.
On Wednesday 25 August 2004 02:30, John Nichel wrote:
This is what I got with ls -al
rahul:/Library/WebServer/Documents/informed-sources.com/imsafm bob$ ls
-al total 16
drwxrwxrwx5 nobody nobody170 24 Aug 13:55 .
drwxrwxrwx 102 bob unknown 3468 24 Aug 11:23 ..
Jason Wong wrote:
snip
If Apache is running as nobody/nobody, it does not have permission to
delete these directories. The only users who can delete these
directories are the respective users, and root. You need to have write
permission to delete...
drwxr-xr-x3 www www 102 24 Aug
On Wednesday 25 August 2004 05:31, John Nichel wrote:
How so? Even if 'nobody' is in the www group, it still wouldn't have
the proper permissions.
To be able to delete directories, you need:
- 'wx' on the parent directory
- 'rx' on the target directory
To be able to delete files, you
* Thus wrote Jason Wong:
Please do not top post.
On Wednesday 25 August 2004 01:31, PHP Junkie wrote:
Ave,
Nope... Didn't work. Didn't return an error or anything, didn't delete the
folders either!
system('rm -rf',$user_dir,$ret_val);
That should be:
system(rm -rf
PHP Junkie wrote:
Again, no error... The entries in the table get deleted.. But file remains
in the directory.
Any suggestions?
Neither of these functions return an error. They will return false on
failure. Does the user/group which your web server is running as have
permission to remove these
Ave,
How do I find out which user/group my web server is running as?
I'm running an Apache Web Server on my Power MAC G5 (Mac OS X) machine.
I can change the user/group permissions... But which user/group does the web
server use?
Thanks.
On 8/23/04 12:08 PM, John Nichel [EMAIL PROTECTED] wrote:
[snip]
How do I find out which user/group my web server is running as?
I'm running an Apache Web Server on my Power MAC G5 (Mac OS X) machine.
I can change the user/group permissions... But which user/group does the
web
server use?
[/snip]
For security reasons Apache typically runs as nobody
--
PHP probably does not have permission to change those files. chmod 777
and it should work.
However now those files are writable by anyone. If you're on a shared
server there could be problems later.
Jon
PHP Junkie wrote:
Ave,
I do not really know what the problem is because I don't get an
PHP Junkie wrote:
Ave,
How do I find out which user/group my web server is running as?
I'm running an Apache Web Server on my Power MAC G5 (Mac OS X) machine.
I can change the user/group permissions... But which user/group does the web
server use?
Default setup? Probably nobody/nobody. Check
Ave,
Well here's my situation...
You see the File Manager allows users to Upload files ... Once a user
uploads the file... It resides in a particular folder on my server. Users
will be constantly uploading, downloading, deleting files. I can't possibly
CHMOD 777 all the time...
My question is...
the chmod 666 sets the exisiting files to be edited by the server.
anything that's uploaded by the server is owned by it, and thusly can be
edited.
as a side note, you'd have to chmod 777 the directory to be edited if
you want uploads to work.
PHP Junkie wrote:
Ave,
Well here's my
Ave,
I do have the original permission set to CHMOD 777 thus the uploads are
working fine.
I had presumed that anything uploaded by the server is owned by it thus I
wouldn't have to interfere with the permissions thereafter... But somehow
that doesn't seem to be working out.
I did actually set
On Tuesday 24 August 2004 00:34, PHP Junkie wrote:
How do I find out which user/group my web server is running as?
I'm running an Apache Web Server on my Power MAC G5 (Mac OS X) machine.
I can change the user/group permissions... But which user/group does the
web server use?
phpinfo() is
Jason Wong wrote
phpinfo() is your friend.
I thought phpinfo() was *MY* friend??? ;)
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
I guess phpinfo() is *OUR* friend!! Great guy!
Although I'd be happier if my files folders started getting deleted with
the script, which still ain't happening.
On 8/23/04 2:32 PM, John Nichel [EMAIL PROTECTED] wrote:
Jason Wong wrote
phpinfo() is your friend.
I thought phpinfo() was
On Tuesday 24 August 2004 02:32, John Nichel wrote:
Jason Wong wrote
phpinfo() is your friend.
I thought phpinfo() was *MY* friend??? ;)
Don't worry it's a one-to-many relationship.
--
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web
On Tuesday 24 August 2004 01:55, PHP Junkie wrote:
I do have the original permission set to CHMOD 777 thus the uploads are
working fine.
I had presumed that anything uploaded by the server is owned by it thus I
wouldn't have to interfere with the permissions thereafter... But somehow
that
Ave,
Richard... What exactly did you mean by this?
system('rm -rf',$user_dir,$ret_val);
I don't understand.
On 8/23/04 12:11 PM, Richard Whitney [EMAIL PROTECTED] wrote:
system('rm -rf',$user_dir,$ret_val);
On Mon, 23 Aug 2004 11:57:35 -0400, PHP Junkie [EMAIL PROTECTED] wrote:
Ave,
This could happpen when the file is open by another process,... then
file is deleted, but filename is still there until the file is not free
of any open filedescriptors... I don't know exactly what processes
happens in kernel when deleting the file, but it's something like
that... and it could
[snip]
I have a file that was 25 KB and I use the unlink() to remove the file.
When I rechecked it, I found that the file is still there but it's
filesize
is 0 KB. Is unlink() suppose to remove the file or what??
[/snip]
You do not say what your OS is, but I just tested on Linux and BSD and
it
See my other post on this one. I don't know, maybe a bug in M$ Outlook or
something. (Whistling and looking away from the issues) :-)
Jay Blanchard [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
[snip]
I have a file that was 25 KB and I use the unlink() to remove the file.
When
Yea, got that. Fixed hte problem. Thanks
Miroslav Hudak [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
This could happpen when the file is open by another process,... then
file is deleted, but filename is still there until the file is not free
of any open filedescriptors... I
At 16:03 26.02.2003, Jøran Sørbø spoke out and said:
[snip]
if (isset($delimage))
{
$result=unlink('$dir_to_upload/$Photo');
$result=mysql_query(
update product set
Photo='nothing',
miniPhoto='nothing',
picture='0'
Hi!
Ive tried to change the script sometimes now and it still dont work...
i still get the error Warning: unlink() failed (No such file or directory)
and it wont remove the data form the database
$dir_to_upload is defined in config.php wich is included...
it works just fine to display image
At 16:42 26.02.2003, Jøran Sørbø spoke out and said:
[snip]
Hi!
Ive tried to change the script sometimes now and it still dont work...
i still get the error Warning: unlink() failed (No such file or directory)
and it wont remove the data form the
At 16:42 26-2-03, you wrote:
$result=unlink('$dir_to_upload/$row-Photo');
what do you get when you echo
echo htmlspecialchars('$dir_to_upload/$row-Photo');
and do you use the full file path? Images accept relative links but in my
experience PHP's file handling functions want the full path.
--
Can't do wildcards like * because thats something that as I found out a few
days ago, is expanded by the shell into a full command, so because your not
running a shell, it can't be expanded and the raw unlink call to *.* fails because
the unlink function doesn't understand wildcards. If you
That will usually work on Unix but will not work on Windows. Rather than
executing an external program you can use PHP itself to do a recursive
delete.
There are examples at http://www.php.net/manual/en/function.rmdir.php if
you read the user notes you will see several posts about doing this.
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hey,
You can't delete the files all at onceyou have to delete them one by one
or use this function that will remove full directories.
- -
function force_rmdirs($dir) {
$dh = opendir($dir);
while(false !== ($file = readdir($dh))) {
On Wed, 20 Nov 2002, JohnMeyer wrote:
Does unlink work with wildcards e.g unlink(somefile*.*);
No.
unlink() is a thin veneer on the system unlink() call.
Wildcard expansion like you have it is done by a shell glob function. You
would need to replicate what the shell does - use it as a regular
Unlink function isn't broken, you just don't have the correct
rights set on the files, so PHP can't erase them, fix the permissions
and that will take care of that error.
Adam Voigt
[EMAIL PROTECTED]
On Thu, 2002-10-31 at 12:46, Andres, Cyrille wrote:
Hello everyone,
I upload some files on
It probably isn't supported in windows. Unlink is (in C) in the unistd.h file.
It provides a way to remove a file based on the unlink syscall (which i
sincerly doubt is available from Win32). Looking at php.net/unlink... yep
fourth comment: unlink() function dosen't work with windows98, but it
Any word on when glob() will be in the production version?
thanks for the help Miquel.
- Original Message -
From: Miguel Cruz [EMAIL PROTECTED]
To: Tom Ray [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Wednesday, June 12, 2002 2:01 AM
Subject: Re: [PHP] Unlink question more or less
You can't use wildcards. Use a system() or exec() call to do it.
Why use the datetime part at all? The usernames are unique, right?
---John Holmes...
-Original Message-
From: Tom Ray [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 11, 2002 11:06 PM
To: [EMAIL PROTECTED]
Subject:
Yeah they are, actaully I switched it to a static name and then added
the time stamp as part of the information I'm gathering. Now I just
re-write the file on each log in.
John Holmes wrote:
You can't use wildcards. Use a system() or exec() call to do it.
Why use the datetime part at all?
: Tuesday, June 11, 2002 11:17 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Unlink question more or less
Yeah they are, actaully I switched it to a static name and then added
the time stamp as part of the information I'm gathering. Now I just
re-write the file on each log
On Tue, 11 Jun 2002, Tom Ray wrote:
I want to use unlink() to delete a wildcard, but at the moment I keep
getting parse errors. Here's what happening:
I'm mucking around with some login stuff, when a user logs in it writes
a flat file that collects some information about them, the flat
On Tue, 28 May 2002, Jimmy Lantz wrote:
(Unlink(file) == rm file) ? (ignore this mail):(explain diffs);
Does PHP unlink function handle deletion of files equally as the rm
command on the system in my case FreeBSD.
Or does it involve caching/handling files in any different way?
It just
Previously, Jimmy Lantz wrote:
(Unlink(file) == rm file) ? (ignore this mail):(explain diffs);
Does PHP unlink function handle deletion of files equally as the rm
command on the system in my case FreeBSD.
Or does it involve caching/handling files in any different way?
It just uses the
Ok that didn't give any output... and I checked in phpinfo() and found
safe_mode off.
Any other ideas?
Sheridan
- Original Message -
From: Jack Dempsey [EMAIL PROTECTED]
To: 'Sheridan Saint-Michel' [EMAIL PROTECTED]
Sent: Friday, July 20, 2001 12:12 PM
Subject: RE: [PHP] Unlink Woes
on 7/20/01 11:48 AM, Sheridan Saint-Michel at [EMAIL PROTECTED] wrote:
Warning: Unlink failed (Permission denied) in
/home/www/foxjet/employees/admin.php on line 108
Here's the code
if($submit == Delete)
{
for ($j = 0; $j $numfiles; $j++)
{
$checkname = $files[$j];
if
[EMAIL PROTECTED] wrote:
on 7/20/01 11:48 AM, Sheridan Saint-Michel at [EMAIL PROTECTED] wrote:
Warning: Unlink failed (Permission denied) in
/home/www/foxjet/employees/admin.php on line 108
snip
I had this error to from unlink, it may be because your server is in safe
mode
/snip
If
I know... that's why I included all the info about how I chmod'ed both the
files and directories 777
If you're running PHP as an Apache module it runs as the owner that Apache
runs as and can only unlink files owned by that user unless the file you
are
trying to unlink is world-writable.
How can I find out if my server is in Safe mode? Do I have to call my Host
and ask them?
Sheridan
- Original Message -
From: [EMAIL PROTECTED]
To: Sheridan Saint-Michel [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Friday, July 20, 2001 11:25 AM
Subject: Re: [PHP] Unlink Woes
on 7/20
Run the function phpinfo();
--
Julio Nobrega.
This is a man's world. But it would be nothing.
It would be nothing without a woman or a girl.
Sheridan Saint-Michel [EMAIL PROTECTED] wrote in message
02d101c1113d$f7a5ccc0$[EMAIL PROTECTED]">news:02d101c1113d$f7a5ccc0$[EMAIL PROTECTED]...
How
Hi Brandon,
@ 2:02:12 PM on 2/7/2001, [EMAIL PROTECTED] wrote:
I am trying to use unlink(); in windows. Does anyone know if unlink
works in windows?
"Note: This function may not work on Windows systems."
http://www.php.net/manual/en/function.unlink.php
Read under 'User Contributed Notes'
84 matches
Mail list logo