473,811 Members | 2,970 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2652
>
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("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 =--
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("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
)


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

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

Similar topics

2
1534
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 file loaded and compiled/interpreted every time a php-file is used that includes this file?
2
3264
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 the packaging. I get my packages from stable. Basically, when I tried to install php4-gd2, I get something like this: php4-gd2 depends on zendapi-20040901 I seem to have that (virtual) package already installed however. The only way I...
0
1289
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 "Regular" PHP scripts work just fine, but the websvn script is acting up - after selecting a repository the page just "hangs", i.e. the browser waits "forever" for a response. If that happens there is no error message in the server log and it looks like...
2
4553
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 they are. i understand most of what the main socket functions do, but i don't understand what's up with this network byte order stuff. could someone explain? --
2
2260
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 http://sfhousemusic.com/newlook/pasingXML.php - test file with this in it: <?php error_reporting(E_ALL);
2
2587
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 users, I use suexec and a wrapper script for php files. to make it a bit clearer, i'll post the different snippets: httpd.conf:
3
2733
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 support. This seems to be a lot tedious. Anyone with an advic on how to use oracle with php. Im using CentOS4 php4 oracle10g
12
2308
by: Drazen Gemic | last post by:
How long will PHP4 be supported ? When is PHP4 end of life scheduled ? DG
8
2324
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 constructors work seem to have changed quite a bit and I am not getting the same behavior across the versions. // Some simple code/
0
9607
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10652
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10395
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10408
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10137
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6895
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5561
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4346
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3874
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.