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.

localhost and 127.0.01 - weird behaviour

Discussion in 'General Discussion' started by hetch, Sep 16, 2013.

  1. hetch

    hetch Active Member

    Joined:
    Feb 4, 2009
    Messages:
    28
    Likes Received:
    0
    Trophy Points:
    1
    I use in my php scripts configuration files 'localhost' to get connected to the database. Works fine.

    But the in same script > mail settings > I can not use 'localhost' to sent email. Getting this error:

    0.66544400 1379291101 15-09-2013 19:25:01 (3)Mailer - [pear_error: message="unable to connect to smtp server localhost:25" code=0 mode=return level=notice prefix="" info=""]

    If I change 'localhost' to '127.0.01' in mail settings , it works. Email will be sent?

    I didn't change any whm/cpanel settings. Anybody throw some light on this?

    thank you!
     
  2. 24x7server

    24x7server Well-Known Member

    Joined:
    Apr 17, 2013
    Messages:
    1,146
    Likes Received:
    34
    Trophy Points:
    48
    Location:
    India
    cPanel Access Level:
    Root Administrator
    It is one and the same you can either use localhost or loop back IP address that is 127.0.0.1 for your mail sending script.

    So not sure if this change will work for you. I would better suggest you to check why your server is not able to connect to port 25 through loop back port.
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,723
    Likes Received:
    660
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    Yes, I have seen this behavior before. It typically happens because the /etc/hosts file is not available to the account. Thus, connections to 'localhost' (which can't resolve to 127.0.0.1) will fail. Using 127.0.0.1 is a valid workaround to this issue.

    Thank you.
     
  4. hetch

    hetch Active Member

    Joined:
    Feb 4, 2009
    Messages:
    28
    Likes Received:
    0
    Trophy Points:
    1
    1. It supposed to be available to the user account by default?

    2. What I need to tell the host to fix this?

    thank you.
     
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,723
    Likes Received:
    660
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    You can direct your web hosting provider to the following URL:

    Custom JailedShell Mounts

    One additional workaround has been to add /etc/hosts to a file that is sourced such as:

    /var/cpanel/exim.conf.deps

    Thank you.
     
  6. hetch

    hetch Active Member

    Joined:
    Feb 4, 2009
    Messages:
    28
    Likes Received:
    0
    Trophy Points:
    1
    My host went with this option.

    But my questions:

    Can this settings can be done thru WHM? If yes, how?

    With each cpanel update, this seting will be over written?

    thank you!
     
  7. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,723
    Likes Received:
    660
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    The setting can not be modified via Web Host Manager, and should not be overwritten during cPanel updates. Could you confirm if that modification resolved the issue?

    Thank you.
     
  8. hetch

    hetch Active Member

    Joined:
    Feb 4, 2009
    Messages:
    28
    Likes Received:
    0
    Trophy Points:
    1
    Yes. '/var/cpanel/exim.conf.deps' resolved the issue. I am able to use localhost again.

    Thank you.
     
Loading...

Share This Page