Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Installation/Configuration

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 28th September 2010, 16:55
Hans Hans is offline
Moderator
 
Join Date: Dec 2005
Location: Montfoort, The Netherlands
Posts: 2,256
Thanks: 212
Thanked 648 Times in 294 Posts
Send a message via Skype™ to Hans
Question php function ftp_delete not deleting anything

It seems that files within the web folder can't be deleted via the php ftp_delete function, like this: ftp_delete ( resource $ftp_stream , string $path )

The server is a Debian Lenny server with ISPConfig3 and PureFTP
php5-fastcgi and suEXEC are enabled for the web.

Is there a solution for this, so it is possible?

Thanks for your help in advance!
__________________
Hans

BB-Hosting | Quality Web Hosting since 2005
Reply With Quote
Sponsored Links
  #2  
Old 28th September 2010, 17:18
till till is online now
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 35,774
Thanks: 821
Thanked 5,332 Times in 4,184 Posts
Default

Are you able to delete the same file when you use a normal FTP client?

You can try to enable debugging in pure-ftpd to see if there are any errors:

http://www.faqforge.com/linux/contro...-debian-linux/
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #3  
Old 28th September 2010, 18:02
Hans Hans is offline
Moderator
 
Join Date: Dec 2005
Location: Montfoort, The Netherlands
Posts: 2,256
Thanks: 212
Thanked 648 Times in 294 Posts
Send a message via Skype™ to Hans
Default

Hi Till,

Yes files can be deleted with a FTP-client like FileZilla.
I will enable debugging to see what happens.
__________________
Hans

BB-Hosting | Quality Web Hosting since 2005
Reply With Quote
  #4  
Old 28th September 2010, 18:07
Hans Hans is offline
Moderator
 
Join Date: Dec 2005
Location: Montfoort, The Netherlands
Posts: 2,256
Thanks: 212
Thanked 648 Times in 294 Posts
Send a message via Skype™ to Hans
Default

O, i forgot to mention: Within the browser when i execute the phpfile, i got the following error:

Code:
Warning: ftp_delete() [function.ftp-delete]: Could not delete /web/foo/filename.ext: Operation not permitted in /var/www/clients/clientXXwebXX/web/filename.php on line XX
When i enable debugging in PureFTPd, i see the follwowing lines appearing in the /var/log/syslog:

Code:
Sep 28 16:13:27 xen1 pure-ftpd: (?@127.0.0.1) [INFO] New connection from 127.0.0.1
Sep 28 16:13:27 hostname pure-ftpd: (?@127.0.0.1) [DEBUG] Command [user] [username]
Sep 28 16:13:27 hostname pure-ftpd: (?@127.0.0.1) [DEBUG] Command [pass] [<*>]
Sep 28 16:13:27 hostname pure-ftpd: (?@127.0.0.1) [INFO] username is now logged in
Sep 28 16:13:27 hostname pure-ftpd: (username@127.0.0.1) [DEBUG] Command [cwd] [/web]
Sep 28 16:13:27 hostname pure-ftpd: (username@127.0.0.1) [DEBUG] Command [dele] [/web/filename.ext]
Sep 28 16:13:27 hostname pure-ftpd: (username@127.0.0.1) [INFO] Logout.
__________________
Hans

BB-Hosting | Quality Web Hosting since 2005

Last edited by Hans; 28th September 2010 at 18:24.
Reply With Quote
  #5  
Old 28th September 2010, 18:41
till till is online now
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 35,774
Thanks: 821
Thanked 5,332 Times in 4,184 Posts
Default

The problem might be the / at the beginning as it can be that the ftp server interperts it as absolute path and not relative path.

Try to delete the file by using the path "web/filename.ext" or just "filename.ext" as there seem to be a "cd" executed before the delete.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #6  
Old 28th September 2010, 19:06
Hans Hans is offline
Moderator
 
Join Date: Dec 2005
Location: Montfoort, The Netherlands
Posts: 2,256
Thanks: 212
Thanked 648 Times in 294 Posts
Send a message via Skype™ to Hans
Default

@Till,
Weird, no result yet.
This is a part of the code used within the phpfile:

Code:
<?php

// ftp constants
define('FTP_USE_FTP', TRUE);
define('FTP_HOST',    'localhost');
define('FTP_PORT',    '21');
define('FTP_TIMEOUT', '20');
define('FTP_PASSIVE', FALSE); /* */
define('FTP_SSL',     FALSE);

// LIVE settings
define('FTP_USER',    'username');
define('FTP_PASS',    'pasword');
define('FTP_PATH_TO_ROOT', '/web');

$ftp_stream = ftp_connect(FTP_HOST, FTP_PORT, FTP_TIMEOUT);

ftp_login($ftp_stream, FTP_USER, FTP_PASS);

// set transfer mode
ftp_pasv($ftp_stream, FTP_PASSIVE);

// set current directory to root of site
ftp_chdir($ftp_stream, FTP_PATH_TO_ROOT);

$file = '/stage/cms/../uploads/images/filename.ext';

ftp_delete($ftp_stream, FTP_PATH_TO_ROOT . $file);

exit;
Any idea what is wrong then here?
(The red line gives the error in the browser)
__________________
Hans

BB-Hosting | Quality Web Hosting since 2005
Reply With Quote
  #7  
Old 28th September 2010, 22:08
Hans Hans is offline
Moderator
 
Join Date: Dec 2005
Location: Montfoort, The Netherlands
Posts: 2,256
Thanks: 212
Thanked 648 Times in 294 Posts
Send a message via Skype™ to Hans
 
Default

@Till,
Probably it has something to do with the path name indeed, but whatever i do i can't get it to work!
Is anyone able to test if the php_delete function is able to its work on an ISPconfig3 server?

Thanks in advance!
__________________
Hans

BB-Hosting | Quality Web Hosting since 2005
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with services!! banzaiwebstudio.com Installation/Configuration 7 19th May 2010 21:13
Error when install ISPConfig 2 with components built from source X-admin Installation/Configuration 5 30th April 2010 13:22
Unable to install ISPConfig bdonecker Installation/Configuration 21 26th May 2009 08:20
Freebsd 6.1 support misterm Installation/Configuration 10 9th April 2009 09:29
Apache2 Freezes celtic Server Operation 31 28th May 2007 17:18


All times are GMT +2. The time now is 16:11.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.