Asterisk manager connection problem :S help

when i try to connect to the manager i get this error:

== Manager ‘’ logged on from 127.0.0.1
[Sep 7 13:04:34] ERROR[24088]: utils.c:1173 ast_careful_fwrite: fwrite() returned error: Broken pipe
[Sep 7 13:04:34] ERROR[24088]: utils.c:1173 ast_careful_fwrite: fwrite() returned error: Broken pipe
[Sep 7 13:04:34] ERROR[24088]: utils.c:1173 ast_careful_fwrite: fwrite() returned error: Broken pipe
[Sep 7 13:04:34] ERROR[24088]: utils.c:1173 ast_careful_fwrite: fwrite() returned error: Broken pipe
[Sep 7 13:04:34] ERROR[24088]: utils.c:1173 ast_careful_fwrite: fwrite() returned error: Broken pipe
== Manager '
’ logged off from 127.0.0.1

my connection script is

<?php $socket = fsockopen("localhost","5038"); fputs($socket, "Action: Login\r\n"); fputs($socket, "UserName: ****\r\n"); fputs($socket, "Secret: ******\r\n\r\n"); fputs($socket, "Action: Command\r\n"); fputs($socket, "Command: sip show users\r\n\r\n"); fclose($socket); ?>

i am using asterisk 1.6.1.1

thanks in advance

manager.conf

[****]
secret=*****
deny=0.0.0.0/0.0.0.0
permit=127.0.0.1/255.255.255.0
read=all
write=all

A broken pipe message can mean any of a number of things, however in your case it sounds like your Connection to the AMI port isn’t staying up during your logon or query. Maybe a bad password or username?

Quick way to troubleshoot, telnet to (your ip address) 5038. You should be presented with “Asterisk Call Manager”. If you see this then type the following,

Action: Login (press enter)
Username: (your username) (press enter)
Secret: (your password) (press enter two times)

If you do not see a,
Response: Success
Message: Authentication accepted

Then check to make sure you have the correct username and password set.

If you do see,

Response: Success
Message: Authentication accepted

Then type in your commands to see if they work, I.E.

Action: Command (press enter)
Command: Sip show users (press enter two times).

If everything works as intended while you are in telnet, logout and try adding an error string and timeout to your php socket statement. Example

$socket = fsockopen(“your ip address goes here”,“5038”, $errno, $errstr, 30);