cancel
Showing results for 
Search instead for 
Did you mean: 

[PAYH] Permissions Issue

noentry
Newbie
Posts: 2
Registered: ‎27-10-2008

[PAYH] Permissions Issue

Hi,
I created a protected directory for use by a PHP application.  I have now removed the protection from it via the control panel but  I am now left with two sub directories created by the application which have an owner of www-data and I cannot delete them!
Any suggestions?
Andy
2 REPLIES 2
Pod
Grafter
Posts: 30
Registered: ‎26-04-2008

Re: [PAYH] Permissions Issue

Hi Andy,
There will be a way of doing this with the Control Panel - but I'm not familiar (yet) with the PlusNet Plesk CP, so here is a clumsy way using PHP code, which should work as you used PHP to create them, and so they will share the same security credentials (user/group)
If this is a one off problem, a way to achieve it is this:
<?php 
// First remove (unlink) any files within the directories
unlink('/path/to/dir1/fileA');
unlink('/path/to/dir2/fileB');
unlink('/path/to/dir2/etc');
// We can now remove (rmdir) the now empty directories
rmdir('/path/to/dir1');
rmdir('/path/to/dir2');
?>

Save the above (suitably modified for your directories and files) to a file on your server, eg zap.php then invoke it via a browser eg http://yourdomain.plushost.co.uk/zap.php
You can read up on the two functions used, ie
Man page for unlink
Man page for rmdir
(which have some working code examples to do this more elegantly, using iterators to first empty then remove, directories)
Say if anything isn't clear;  HTH
noentry
Newbie
Posts: 2
Registered: ‎27-10-2008

Re: [PAYH] Permissions Issue

Hi Pod,
Thanks for the bit of PHP it did the trick.
The PHP code is less clumsy that trying to find functions in the control panel 😉
An additional note, I found a PHP filemanager http://phpfm.sourceforge.net/ which works well enough to sort out various file issues.
Andy