Re: [PHP] fsockopen to own server

2004-12-22 Thread Doc
Thanks for your (and everyone else's) help so far.

I've given up on this. Got another one off the web which uses pop3 and
mail() to achieve the same thing.

Thanks anyway
Dave

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] fsockopen to own server

2004-12-20 Thread Richard Lynch
Doc wrote:
> On Mon, 20 Dec 2004 07:51:46 -0800, Richard Lynch wrote:
>>
>> WILD GUESS ALERT!
>>
>> What you got in /etc/hosts.allow and /etc/hosts.deny?...
>
> nothing in there other than default install comments.
>
>> Or any kind of other anti-bad-guy technology?...
>
> nope.
>
>> Does it work if you use 127.0.0.1 for the IP/URL?
>> How about the actual IP of the machine?
>> localhost?
>
> d) none of the above :)
>
>> Just throwing out random things to try that might lead you somewhere.
>
> much appreciated. I'm willing to sacrifice young lambs at this stage.

Okay, pull out ethereal and netstat -a to see what connections are being
tried/attempted/whatever.

Maybe even tcpdump to see what is going back and forth.

If all else fails, here's a TOTAL HACK:

Write a PHP script on some other server that connects back to the first
server and opens the socket and does whatever you need it to do.

Now have your script connect to the other server and use its sockets to do
what you need.

This is clearly *NOT* a Good Idea for a long-term solution, but could get
you past this hump long enough to survive, and maybe even make you realize
just why the same-machine system doesn't work.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] fsockopen to own server

2004-12-20 Thread Doc
On Mon, 20 Dec 2004 07:51:46 -0800, Richard Lynch wrote:
> 
> WILD GUESS ALERT!
> 
> What you got in /etc/hosts.allow and /etc/hosts.deny?...

nothing in there other than default install comments.
 
> Or any kind of other anti-bad-guy technology?...

nope.

> Does it work if you use 127.0.0.1 for the IP/URL?
> How about the actual IP of the machine?
> localhost?

d) none of the above :)
 
> Just throwing out random things to try that might lead you somewhere.

much appreciated. I'm willing to sacrifice young lambs at this stage.

Cheers
Doc

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] fsockopen to own server

2004-12-20 Thread Richard Lynch
Doc wrote:
>> not sure what you are trying to do but it sounds like you are using unix
>> domain sockets where you should be using tcp. That's why it might work
>> on one machine (where web and imap are both installed) and not on the
>> other where you only have the web server but the imap server is remote.
>
> This is actually the opposite of what is happening. It will work on the
> remote server but not the local one. I've tried using unix:// and it made
> no difference.
>
> Any other suggestions?

WILD GUESS ALERT!

What you got in /etc/hosts.allow and /etc/hosts.deny?...

Or any kind of other anti-bad-guy technology?...

Does it work if you use 127.0.0.1 for the IP/URL?
How about the actual IP of the machine?
localhost?

Just throwing out random things to try that might lead you somewhere.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] fsockopen to own server

2004-12-20 Thread Doc
On Thu, 16 Dec 2004 23:37:36 +0600, Raditha Dissanayake wrote:

> 
>> Escape character is '^]'.
>>* OK [CAPABILITY IMAP4REV1 LOGIN-REFERRALS AUTH=LOGIN]
>>serverip IMAP4rev1 2003.339-cpanel at Wed, 15 Dec 2004
>>19:33:27 + (GMT)
>>
>>so I don't think it's the firewall. 
>>
> usually a good idea to disable firewalls when having trouble with socket 
> code.

Tried that. didn't make any difference.

>>if(($s = fsockopen($id["sockname"], 0, $errno, $errstr)) === FALSE)
>>
>>$id["sockname"] is in the format /tmp/filename with the filename changing
>>based on a random value and there are no files with that format in /tmp 
>>
>>it always returns false for some reason on this server.
>>  
>>
> not sure what you are trying to do but it sounds like you are using unix 
> domain sockets where you should be using tcp. That's why it might work 
> on one machine (where web and imap are both installed) and not on the 
> other where you only have the web server but the imap server is remote.

This is actually the opposite of what is happening. It will work on the
remote server but not the local one. I've tried using unix:// and it made
no difference.

Any other suggestions?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] fsockopen to own server

2004-12-20 Thread Doc
On Thu, 16 Dec 2004 10:02:02 -0800, Richard Lynch wrote:

> Doc wrote:
>> I'm having a problem with fsockopen and was wondering has anyone ever
>> noticed a case where it will work from machine1 (dev machine) to machine2.
>> But when the was placed onto machine2 it wouldn't work connecting to it's
>> own ip address;
>>
>> when connecting via telnet it returns:
>>
>>  Escape character is '^]'.
>> * OK [CAPABILITY IMAP4REV1 LOGIN-REFERRALS AUTH=LOGIN]
>> serverip IMAP4rev1 2003.339-cpanel at Wed, 15 Dec 2004
>> 19:33:27 + (GMT)
> 
> You *ARE* getting this when telnetting from/to the same machine, right?...

Yes. the same machine.

>> so I don't think it's the firewall. the error it returns is "No such file
>> or directory". So it seems that when it connects (which it does without
>> failing), the file seems to be deleted, as the file the variable refers to
>> doesn't exist on the fs either.
>>
>> if(($s = fsockopen($id["sockname"], 0, $errno, $errstr)) === FALSE)
>>
>> $id["sockname"] is in the format /tmp/filename with the filename changing
>> based on a random value and there are no files with that format in /tmp
> 
> Despite the user contributed note on
> http://php.net/manual/en/transports.unix.php
> I'm wondering if you shouldn't use the unix:// bit -- and try udg:// as
> well, if that doesn't work.

Tried both without any success.

> Finally, if there are no files with that format in /tmp, how will this
> work?  Or is that how unix socket streams are supposed to work?  I'm
> ignorant in this area...  But it seems to me that if you try to open a
> file that's not there, you SHOULD get FALSE back. :-)

I'm as ignorant as you :) this is an ex-coworkers code. From
what I can tell from the file should be there from when it connects
initially (as that's the way it is when it's on the dev machine) but
they're not although there is no failure to connect, which suggests to me
that the file is deleted.

>> it always returns false for some reason on this server.
> 
> And what, if anything, are in $errno and $errstr?
> 
> You've put them in there, you might as well use them :-)

$errno 2
$errstr "No such file or directory"

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] fsockopen to own server

2004-12-16 Thread Richard Lynch
Doc wrote:
> I'm having a problem with fsockopen and was wondering has anyone ever
> noticed a case where it will work from machine1 (dev machine) to machine2.
> But when the was placed onto machine2 it wouldn't work connecting to it's
> own ip address;
>
> when connecting via telnet it returns:
>
>  Escape character is '^]'.
> * OK [CAPABILITY IMAP4REV1 LOGIN-REFERRALS AUTH=LOGIN]
> serverip IMAP4rev1 2003.339-cpanel at Wed, 15 Dec 2004
> 19:33:27 + (GMT)

You *ARE* getting this when telnetting from/to the same machine, right?...

> so I don't think it's the firewall. the error it returns is "No such file
> or directory". So it seems that when it connects (which it does without
> failing), the file seems to be deleted, as the file the variable refers to
> doesn't exist on the fs either.
>
> if(($s = fsockopen($id["sockname"], 0, $errno, $errstr)) === FALSE)
>
> $id["sockname"] is in the format /tmp/filename with the filename changing
> based on a random value and there are no files with that format in /tmp

Despite the user contributed note on
http://php.net/manual/en/transports.unix.php
I'm wondering if you shouldn't use the unix:// bit -- and try udg:// as
well, if that doesn't work.

Finally, if there are no files with that format in /tmp, how will this
work?  Or is that how unix socket streams are supposed to work?  I'm
ignorant in this area...  But it seems to me that if you try to open a
file that's not there, you SHOULD get FALSE back. :-)

> it always returns false for some reason on this server.

And what, if anything, are in $errno and $errstr?

You've put them in there, you might as well use them :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] fsockopen to own server

2004-12-16 Thread Raditha Dissanayake
Doc wrote:
Hello.
I'm having a problem with fsockopen and was wondering has anyone ever
noticed a case where it will work from machine1 (dev machine) to machine2.
 

happens all the time :-)
But when the was placed onto machine2 it wouldn't work connecting to it's
own ip address; 

when connecting via telnet it returns:
Escape character is '^]'.
* OK [CAPABILITY IMAP4REV1 LOGIN-REFERRALS AUTH=LOGIN]
serverip IMAP4rev1 2003.339-cpanel at Wed, 15 Dec 2004
19:33:27 + (GMT)
so I don't think it's the firewall. 

usually a good idea to disable firewalls when having trouble with socket 
code.

the error it returns is "No such file
or directory". So it seems that when it connects (which it does without
failing), the file seems to be deleted, as the file the variable refers to
doesn't exist on the fs either.
if(($s = fsockopen($id["sockname"], 0, $errno, $errstr)) === FALSE)
$id["sockname"] is in the format /tmp/filename with the filename changing
based on a random value and there are no files with that format in /tmp 

it always returns false for some reason on this server.
 

not sure what you are trying to do but it sounds like you are using unix 
domain sockets where you should be using tcp. That's why it might work 
on one machine (where web and imap are both installed) and not on the 
other where you only have the web server but the imap server is remote.

--
Raditha Dissanayake.
--
http://www.radinks.com/print/card-designer/ | Card Designer Applet
http://www.radinks.com/upload/  | Drag and Drop Upload 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] fsockopen to own server

2004-12-16 Thread Doc
Hello.

I'm having a problem with fsockopen and was wondering has anyone ever
noticed a case where it will work from machine1 (dev machine) to machine2.
But when the was placed onto machine2 it wouldn't work connecting to it's
own ip address; 

when connecting via telnet it returns:

 Escape character is '^]'.
* OK [CAPABILITY IMAP4REV1 LOGIN-REFERRALS AUTH=LOGIN]
serverip IMAP4rev1 2003.339-cpanel at Wed, 15 Dec 2004
19:33:27 + (GMT)

so I don't think it's the firewall. the error it returns is "No such file
or directory". So it seems that when it connects (which it does without
failing), the file seems to be deleted, as the file the variable refers to
doesn't exist on the fs either.

if(($s = fsockopen($id["sockname"], 0, $errno, $errstr)) === FALSE)

$id["sockname"] is in the format /tmp/filename with the filename changing
based on a random value and there are no files with that format in /tmp 

it always returns false for some reason on this server.

Thanks in advance for your help.
Dave

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php