473,396 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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
Jul 17 '05 #1
7 2614
>
Is anyone able to send me in the right direction ?


Maybe your server has a firewall which blocks the ports that these
PHP/network-commands use?
Jul 17 '05 #2
Adam Nørregaard wrote:

Is anyone able to send me in the right direction ?


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


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

Jul 17 '05 #3
Mike M wrote:
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.


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 =--
Jul 17 '05 #4
Hello,

On 12/30/2003 10:41 AM, Mike M wrote:
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 ?


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
http://www.phpclasses.org/phpresolver

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
http://www.phpclasses.org/emailvalidation

--

Regards,
Manuel Lemos

Free ready to use OOP components written in PHP
http://www.phpclasses.org/

Jul 17 '05 #5
Pedro Graca wrote:
Mike M wrote:
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.
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 :)


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


$ 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


Jul 17 '05 #6
Mike M wrote:
Now I'm *really* confused ... [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 !


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

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

$ php -r 'if(getmxrr("xtra.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 =--
Jul 17 '05 #7
Pedro Graca wrote:
Mike M wrote:
Now I'm *really* confused ...

[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 !


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

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

$ php -r 'if(getmxrr("xtra.co.nz", $a)) print_r($a); else echo "FALSE\n";'
Array
(
[0] => mta.xtra.co.nz
)


*YAYYYYYYYYYYYYYYY* !!!
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 :-)
Jul 17 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Erwin Moller | last post by:
Hi group, I have an includefile that I (ahum) include in many scripts. It contains only functions I need now and then. Now I was wondering how things work behind the scenes. Is the whole...
2
by: Brad Shinoda | last post by:
I've been running apache and PHP by using apt-get packages for a long time now, and it's been working fine for me. But the other day I tried to get image functions working and hit a brick wall with...
0
by: FrankL | last post by:
I had to update my server configuration consisting of Apache2 and PHP4. I now have installed: apache2/apache2-prefork 2.0.54-2.1 apache-mod_php4/php4-zlib/php4 4.3.11-0.3.1 ...
2
by: Jesse Engle | last post by:
i'm learning how to do some basic low-level network programming. the site i'm reading talks about "network byte order" and "host byte order". the thing is, it doesn't give an explanation as to what...
2
by: alkazakov | last post by:
I did the parsing XML and it works on my computer (PHP5), but as usual it doesn't on the clients server (PHP4) =) can you look into it: http://sfhousemusic.com/newlook/phpinfo.php...
2
by: Stefan Huber | last post by:
Hi I've got a really strange problem, and can't find out why it's not working as intended. in order to use php4 and 5 together on a webserver and the requirement for running as different...
3
by: danish | last post by:
Hi, Can anyone tell me how to access oracle from php. Im using CentOS 4 with php4 already installed. From what I found after a bit of googling...php will have to be recompiled with oracle...
12
by: Drazen Gemic | last post by:
How long will PHP4 be supported ? When is PHP4 end of life scheduled ? DG
8
by: FFMG | last post by:
Hi, I am slowly moving my code to php5. But I would like to make it backward compatible in case something bad happens, (and to make sure I understand what the changes are). The way the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.