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.

Does curl get or (php) 'file (url)' from own IP count towards bandwidth ??

Discussion in 'Workarounds and Optimization' started by gcutrer, Mar 26, 2012.

  1. gcutrer

    gcutrer Member

    Joined:
    Dec 13, 2004
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Here's the situation -- site I am doing a security audit on a shared hosting website that uses flat file text databases. Site owner is concerned about bandwidth usage which spikes now and again.

    I have grep'ped the logs in search of problems but can't find any big ones. BUT, noticed that very often an entire flatfile database is "slurped" and served via http and ends up in webserver logs.

    The requesting IP address, however, every time is the hosting address for the site -- the site's own IP.

    Further looking around and it seems the coder used the PHP 'file' function to slurp each database as needed into a big array and then manipulated the data. Clunky, yes, I know, but that's not what my question is.

    When he 'slurped' he did something like $dataArray = file ("http://thisdomain.com/path/to/data.txt");
    Instead of $dataArray = file ("/root/local/path/to/data.txt");

    So, 'file' is fetching the data with http request and the request ends up in the logs. Some of these databases are 100K, 200K, 350K in size.

    Question: Does this HTTP get request, which ends up in the webserver logs and which is coming from the site's own IP address, go into what WHM/Cpanel calculates as 'Bandwidth.' ??

    (I've looked at FTP and email bandwidth and they're reasonable, it's http bandwidth that's spiking).


    Does anybody know the answer to this?
     
  2. gcutrer

    gcutrer Member

    Joined:
    Dec 13, 2004
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Re: Does curl get or (php) 'file (url)' from own IP count towards bandwidth

    Anybody? Anybody? Bueller? Bueller?
     
  3. gcutrer

    gcutrer Member

    Joined:
    Dec 13, 2004
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Re: Does curl get or (php) 'file (url)' from own IP count towards bandwidth

    Any Cpanel experts/developers/script maintainers here? Could you please weigh in?
     
  4. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Re: Does curl get or (php) 'file (url)' from own IP count towards bandwidth

    Any request to a url rather than a relative path on the server will use Apache bandwidth for transferring the data when that url is an Apache one (http) unless the url were using localhost directly such as http://localhost or http://127.0.0.1 (since it wouldn't then leave the server).
     
  5. gcutrer

    gcutrer Member

    Joined:
    Dec 13, 2004
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Re: Does curl get or (php) 'file (url)' from own IP count towards bandwidth

    OK. Still the question remains: Does WHM/Cpanel count that 'get' request of so many, e.g. 300Kb, as going toward total used bandwidth?? Even though the request is coming from the same machine, albeit on one of the machine's assigned IP addresses.

    You know, toward bandwidth quota. Of course I suppose it shows up in access log reports like awstats, etc.
     
  6. Eric

    Eric Administrator
    Staff Member

    Joined:
    Nov 25, 2007
    Messages:
    746
    Likes Received:
    11
    Trophy Points:
    18
    Location:
    Texas
    cPanel Access Level:
    Root Administrator
    Re: Does curl get or (php) 'file (url)' from own IP count towards bandwidth

    Howdy,

    This data does show up in the logs but it is not counted in bandwidth logging.

    Thanks!
     

Share This Page