Reply to Re: how to delete directories that are created by PHP?

Your name:

Reply:


Posted by Christoph Burschka on 02/01/07 08:41

J.O. Aho schrieb:
> Eric Layman wrote:
>
>> Thanks
>>
>> What I meant was,
>>
>> are there any other solutions other than using php's RMDIR?
>
>
> You could always use exec() and use the systems "rm -rf" instead, as
> long as the webserver is owning the directories, it should go well, and
> with "rm -rf" the directory can be full.
>
Unless PHP safe-mode is enabled - with the file permissions set up in
such a messy way (PHP-created files aren't owned by the FTP user), it's
pretty likely. If that is the case, exec() has no chance.

There might be a way by making a PHP script that deletes them (or making
a PHP script that makes a PHP script that deletes them), but it's awful.

It'd probably be easier to send a support request to your host and ask
them to delete the folders. I've had a similar problem and tried for
several days to delete the folders myself - unsuccessfully.

-------

If you really need to dynamically create and delete folders from PHP and
have them owned by your FTP user - and you can't change the server
configuration - here's a way that's worked for me:

Have PHP connect to its own server over FTP, logging in with your
account. Inconvenient, but it works.

$link=ftp_connect("localhost");
ftp_login($link,"user","password");
ftp_chdir($link,"your/file/path");
ftp_mkdir($link,"new_folder");
ftp_rmdir($link,"new_folder");
ftp_close($link);

See http://php.net/ftp for more detailed information.

--
CB

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация