The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PureFTP and PHP so sloooow but ProFTP ok

Discussion in 'General Discussion' started by jstucken, Aug 30, 2005.

  1. jstucken

    jstucken Registered

    Joined:
    Aug 30, 2005
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Hi,


    I am a web developer on a reseller hosting account using a Cpanel backend. I have developed some custom PHP scripts that FTP's into server and list what files are on there. These PHP scripts have been running fine on my webserver for the last 8 months, but just recently they are running realllly slow.

    I contacted my webhost and they said they have installed the latest security patch for Cpanel which fixed a security issue with ProFTP. They tell me Cpanel is now running PureFTP. PureFTP causes nightemares with my PHP scripts. They work ok when there is say, up to 10 files on the FTP server but start to hang when over 20.

    Here is an example, here is my PHP script obtaining a list of files on an external ProFTP server:

    http://www.glowormdesign.com.au/newsletters/testftp/proftp.php

    and here is the exact same code running on the exact same server, yet retrvieing a list of files from a PureFTP webserver:

    http://www.glowormdesign.com.au/newsletters/testftp/pureftp.php


    When ProFTP was being used it used to handle 200+ files no problem.

    My question is when will the ProFTP/Cpanel security hole be patched in Cpanel so I can go back to using ProFTP?

    Has anyone else had simliar issues?


    Thanks in advance for your feedback

    thanks

    Jono
     
  2. wazza214

    wazza214 Registered

    Joined:
    Aug 30, 2005
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Hello Jono,

    Interesting the people you find on the internet.

    regards

    Warren
     
  3. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    Are you enabling PASV mode in your FTP client before connecting to the server running pure-ftpd? There's no reason for pure-ftpd to be slower than proftpd, indeed most usually find it much quicker.
     
  4. jstucken

    jstucken Registered

    Joined:
    Aug 30, 2005
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Hi Chirpy,

    Thanks for your suggestion...

    Yes, I was running in passive mode with PHP (ftp_pasv function). I disabled this and it still ran slow. Upon experimenting some more with my PHP code I found what was causing problems with PureFTP:

    #### CHECK IF THE CURRENT ITEM ON FTP SERVER IS A DIRECTORY OR A FILE ####
    ## if we can ftp_chdir ok then it must be a dir ##

    if (@ftp_chdir($conn, $itempath)) {
    ftp_cdup($conn);
    ?>
    <tr>
    <td><img src="../images/icon-closefold.gif" width="17" height="17" border="0"></td>
    <td><a href="<? echo $item ?>"><? echo $item ?></a></td>
    <td></td>
    <td></td>
    </tr>
    <?
    }

    This code was checking each item on the FTP server to see if it was a file or directory by trying to change directory using PHP's ftp_chdir function. If it could change directory succesfully that would mean the item was a directory, not a file. While this code worked fine under ProFTP, it caused serious problems under PureFTP.

    Interestingly, this code was suggested on PHP.net in their manual (though admittedly, it was a user suggestion). Obviously they had not tested it on a PureFTP server.


    http://au3.php.net/manual/en/function.ftp-nlist.php


    If anyone else is experiencing simliar problems hopefully this may help..

    ps Warren yes interesting indeed who we meet on the net!
     
Loading...

Share This Page