PHP4 network functions

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mike M

    PHP4 network functions

    Seasons greetings folks

    I'm pretty sure that this problem has nothing to do with PHP and a whole lot
    to do with my server config, but I've got no idea where to start.

    On my server I can't get any of the network functions to work, eg getmxrr()
    returns an empty array whereas on another server it will return a populated
    array.

    Sendmail functions perfectly and I can ping the remote machines, so it's not
    a problem with iptables stopping outgoing traffic, or with named.

    Is anyone able to send me in the right direction ?

    TIA
    Mike
  • Adam Nørregaard

    #2
    Re: PHP4 network functions

    >[color=blue]
    >Is anyone able to send me in the right direction ?[/color]

    Maybe your server has a firewall which blocks the ports that these
    PHP/network-commands use?

    Comment

    • Mike M

      #3
      Re: PHP4 network functions

      Adam Nørregaard wrote:
      [color=blue][color=green]
      >>
      >>Is anyone able to send me in the right direction ?[/color]
      >
      > Maybe your server has a firewall which blocks the ports that these
      > PHP/network-commands use?[/color]

      Nope, not unless Mandrake has set up its own firewall ...
      [root@fred root]# iptables -L
      Chain INPUT (policy ACCEPT)
      target prot opt source destination

      Chain FORWARD (policy ACCEPT)
      target prot opt source destination

      Chain OUTPUT (policy ACCEPT)
      target prot opt source destination

      Comment

      • Pedro Graca

        #4
        Re: PHP4 network functions

        Mike M wrote:[color=blue]
        > I'm pretty sure that this problem has nothing to do with PHP and a whole lot
        > to do with my server config, but I've got no idea where to start.
        >
        > On my server I can't get any of the network functions to work, eg getmxrr()
        > returns an empty array whereas on another server it will return a populated
        > array.[/color]

        What happens when you try

        $ host -t MX yahoo.com

        I did it right now and got:
        yahoo.com mail is handled by 1 mx1.mail.yahoo. com.
        yahoo.com mail is handled by 1 mx2.mail.yahoo. com.
        yahoo.com mail is handled by 5 mx4.mail.yahoo. com.

        But, on my machine, php's getmxrr() works as expected :)


        $ php -v
        PHP 4.3.3 (cli) (built: Nov 19 2003 23:12:29)
        Copyright (c) 1997-2003 The PHP Group
        Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies
        --
        --= my mail box only accepts =--
        --= Content-Type: text/plain =--
        --= Size below 10001 bytes =--

        Comment

        • Manuel Lemos

          #5
          Re: PHP4 network functions

          Hello,

          On 12/30/2003 10:41 AM, Mike M wrote:[color=blue]
          > Seasons greetings folks
          >
          > I'm pretty sure that this problem has nothing to do with PHP and a whole lot
          > to do with my server config, but I've got no idea where to start.
          >
          > On my server I can't get any of the network functions to work, eg getmxrr()
          > returns an empty array whereas on another server it will return a populated
          > array.
          >
          > Sendmail functions perfectly and I can ping the remote machines, so it's not
          > a problem with iptables stopping outgoing traffic, or with named.
          >
          > Is anyone able to send me in the right direction ?[/color]

          Your DNS is probably not allowing to forward requests, i.e. only
          responds for requests about you machine domains.

          In that case you may want to try this DNS resolver class that lets you
          configures some other (open) DNS to ask about other domains. It comes
          with GetMXRR() emulation function.

          Class: DNSResolver


          This class also has been used by this other e-mail address validation
          class to handle situations when GetMXRR() is not function, like for
          instance under Windows or when in DNS forwarding is disabled as it seems
          to be your case.

          Class: E-mail address validation class




          --

          Regards,
          Manuel Lemos

          Free ready to use OOP components written in PHP
          Free PHP Classes and Objects 2025 Versions with PHP Example Scripts, PHP Tutorials, Download PHP Scripts, PHP articles, Remote PHP Jobs, Hire PHP Developers, PHP Book Reviews, PHP Language OOP Materials


          Comment

          • Mike M

            #6
            Re: PHP4 network functions

            Pedro Graca wrote:
            [color=blue]
            > Mike M wrote:[color=green]
            >> I'm pretty sure that this problem has nothing to do with PHP and a whole
            >> lot to do with my server config, but I've got no idea where to start.
            >>
            >> On my server I can't get any of the network functions to work, eg
            >> getmxrr() returns an empty array whereas on another server it will return
            >> a populated array.[/color]
            >
            > What happens when you try
            >
            > $ host -t MX yahoo.com
            >
            > I did it right now and got:
            > yahoo.com mail is handled by 1 mx1.mail.yahoo. com.
            > yahoo.com mail is handled by 1 mx2.mail.yahoo. com.
            > yahoo.com mail is handled by 5 mx4.mail.yahoo. com.
            >
            > But, on my machine, php's getmxrr() works as expected :)[/color]

            Now I'm *really* confused ...

            [meetakiwi@fred meetakiwi]$ host -t MX yahoo.com
            yahoo.com mail is handled by 1 mx1.mail.yahoo. com.
            yahoo.com mail is handled by 1 mx2.mail.yahoo. com.
            yahoo.com mail is handled by 5 mx4.mail.yahoo. com.
            [meetakiwi@fred meetakiwi]$ host -t MX xtra.co.nz
            xtra.co.nz mail is handled by 10 mta.xtra.co.nz.

            Is it possible that PHP thinks it's on a Windows machine instead of Linux ?
            okay, I'm clutching at straws here !

            Cheers
            Mike
            [color=blue]
            >
            >
            > $ php -v
            > PHP 4.3.3 (cli) (built: Nov 19 2003 23:12:29)
            > Copyright (c) 1997-2003 The PHP Group
            > Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies[/color]

            Comment

            • Pedro Graca

              #7
              Re: PHP4 network functions

              Mike M wrote:[color=blue]
              > Now I'm *really* confused ...[/color]
              [color=blue]
              > [meetakiwi@fred meetakiwi]$ host -t MX xtra.co.nz
              > xtra.co.nz mail is handled by 10 mta.xtra.co.nz.[/color]
              [color=blue]
              > Is it possible that PHP thinks it's on a Windows machine instead of Linux ?
              > okay, I'm clutching at straws here ![/color]

              lol


              Are you sure you didn't somehow change the host name?

              $ php -r 'if(getmxrr("xt ra.co.nz2", $a)) print_r($a); else echo "FALSE\n";'
              FALSE

              $ php -r 'if(getmxrr("xt ra.co.nz", $a)) print_r($a); else echo "FALSE\n";'
              Array
              (
              [0] => mta.xtra.co.nz
              )
              --
              --= my mail box only accepts =--
              --= Content-Type: text/plain =--
              --= Size below 10001 bytes =--

              Comment

              • Mike M

                #8
                Re: PHP4 network functions

                Pedro Graca wrote:
                [color=blue]
                > Mike M wrote:[color=green]
                >> Now I'm *really* confused ...[/color]
                >[color=green]
                >> [meetakiwi@fred meetakiwi]$ host -t MX xtra.co.nz
                >> xtra.co.nz mail is handled by 10 mta.xtra.co.nz.[/color]
                >[color=green]
                >> Is it possible that PHP thinks it's on a Windows machine instead of Linux
                >> ? okay, I'm clutching at straws here ![/color]
                >
                > lol
                >
                >
                > Are you sure you didn't somehow change the host name?
                >
                > $ php -r 'if(getmxrr("xt ra.co.nz2", $a)) print_r($a); else echo
                > "FALSE\n";' FALSE
                >
                > $ php -r 'if(getmxrr("xt ra.co.nz", $a)) print_r($a); else echo "FALSE\n";'
                > Array
                > (
                > [0] => mta.xtra.co.nz
                > )[/color]

                *YAYYYYYYYYYYYY YYY* !!!
                Thank you !!! It turns out that for getmxrr() to work under Apache, the
                server directive HostnameLookups must be On, not Off !

                Thanks Pedro :-) May you have a wonderful New Year :-)

                Comment

                Working...