dlarchikov / php-amqplib

Automatically exported from code.google.com/p/php-amqplib
GNU Lesser General Public License v2.1
0 stars 0 forks source link

demo doesn't work on php5.3 #22

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
< [hex]:
0000  41 4D 51 50 01 01 09 01                            AMQP.... 

waiting for 10,10
waiting for a new frame
PHP Warning:  feof() expects parameter 1 to be resource, object given in 
/home/erlang/gosea-server/php-amqplib/amqp_wire.inc on line 302
PHP Warning:  fread() expects parameter 1 to be resource, object given in 
/home/erlang/gosea-server/php-amqplib/amqp_wire.inc on line 303
PHP Fatal error:  Uncaught exception 'Exception' with message 'Error reading 
data. Recevived 0 instead of expected 1 bytes' in 
/home/erlang/gosea-server/php-amqplib/amqp_wire.inc:317
Stack trace:
#0 /home/erlang/gosea-server/php-amqplib/amqp_wire.inc(348): 
AMQPReader->rawread(1)
#1 /home/erlang/gosea-server/php-amqplib/amqp.inc(494): AMQPReader->read_octet()
#2 /home/erlang/gosea-server/php-amqplib/amqp.inc(514): 
AMQPConnection->wait_frame()
#3 /home/erlang/gosea-server/php-amqplib/amqp.inc(166): 
AMQPConnection->wait_channel(0)
#4 /home/erlang/gosea-server/php-amqplib/amqp.inc(251): 
AbstractChannel->next_frame()
#5 /home/erlang/gosea-server/php-amqplib/amqp.inc(350): 
AbstractChannel->wait(Array)
#6 /home/erlang/gosea-server/php-amqplib/demo/amqp_publisher.php(19): 
AMQPConnection->__construct('localhost', 5672, 'guest', 'guest')
#7 {main}
  thrown in /home/erlang/gosea-server/php-amqplib/amqp_wire.inc on line 317

Please provide any additional information below.

Original issue reported on code.google.com by wenew...@gmail.com on 1 Mar 2011 at 9:45

GoogleCodeExporter commented 8 years ago
hi guys,

please include these patches.

thx

best regards,
David

Original comment by bowi...@gmail.com on 28 Apr 2011 at 1:03

Attachments:

GoogleCodeExporter commented 8 years ago
Thank you for your patches. I have partially commited them, but I have question 
about following parts:

-            $this->sock->close();
+            fclose($this->sock);

why fclose() is better than using close() method of sock?

And why you suggest to remove BufferedInput:

-            $this->sock = new BufferedInput($sock);
+            $this->sock = $sock;

Original comment by kroko...@gmail.com on 30 Apr 2011 at 5:53

GoogleCodeExporter commented 8 years ago
applied these patches, stil I am getting this 

Notice: Object of class BufferedInput could not be converted to int in 
/var/www/php/lib/php-amqplib/amqp_wire.inc on line 263

Fatal error: Uncaught exception 'Exception' with message 'Error reading data. 
Recevived 0 instead of expected 1 bytes' in 
/var/www/php/lib/php-amqplib/amqp_wire.inc:319 Stack trace: #0 
/var/www/php/lib/php-amqplib/amqp_wire.inc(350): AMQPReader->rawread(1) #1 
/var/www/php/lib/php-amqplib/amqp.inc(494): AMQPReader->read_octet() #2 
/var/www/php/lib/php-amqplib/amqp.inc(514): AMQPConnection->wait_frame() #3 
/var/www/php/lib/php-amqplib/amqp.inc(166): AMQPConnection->wait_channel(0) #4 
/var/www/php/lib/php-amqplib/amqp.inc(251): AbstractChannel->next_frame() #5 
/var/www/php/lib/php-amqplib/amqp.inc(350): AbstractChannel->wait(Array) #6 
/var/www/php/send.php(5): AMQPConnection->__construct('localhost', 80, 'guest', 
'guest') #7 {main} thrown in /var/www/php/lib/php-amqplib/amqp_wire.inc on line 
319

Original comment by hitesh.w...@gmail.com on 22 Oct 2011 at 2:03

GoogleCodeExporter commented 8 years ago
Same problem here.

Fatal error: Uncaught exception 'Exception' with message 'Error reading data. 
Recevived 0 instead of expected 1 bytes' in 
/home/me/public_html/include/mq/amqp_wire.inc:317
Stack trace:
#0 /home/me/public_html/include/mq/amqp_wire.inc(348): AMQPReader->rawread(1)
#1 /home/me/public_html/include/mq/amqp.inc(590): AMQPReader->read_octet()
#2 /home/me/public_html/include/mq/amqp.inc(610): AMQPConnection->wait_frame()
#3 /home/me/public_html/include/mq/amqp.inc(178): 
AMQPConnection->wait_channel(0)
#4 /home/me/public_html/include/mq/amqp.inc(282): AbstractChannel->next_frame()
#5 /home/me/public_html/include/mq/amqp.inc(652): AbstractChannel->wait(Array)
#6 /home/me/public_html/include/mq/amqp.inc(458): AMQPConnection->close()
#7 [internal function]: AMQPConnection->__destruct()
#8 {main}
  thrown in /home/me/public_html/include/mq/amqp_wire.inc on line 317

My environment:
PHP 5.3.6
rabbitmq-server-2.7.1-1.noarch.rpm
erlang.x86_64 R14B-03.3.el5

Original comment by Sean.Kel...@gmail.com on 31 Jan 2012 at 3:27

GoogleCodeExporter commented 8 years ago
There were no changes from the first patch to apply and only a minimal set of 
changes from the second patch to apply.

Once done I then started receiving this error:
Fatal error: Call to a member function real_sock() on a non-object in 
/home/trustacq/public_html/include/mq/amqp_wire.inc on line 305

This is because you requested this change in the patch:
-            $this->sock = new BufferedInput($sock);
+            $this->sock = $sock;

So then I did a bit more investigation, your amqp_consumer.php and 
amqp_publisher.php examples were working ok for me so I then assumed it was an 
error in my own code.

But then I changed the username and password in the config.php and ran your 
examples again only to receive this error:

Fatal error: Uncaught exception 'Exception' with message 'Error reading data. 
Recevived 0 instead of expected 1 bytes' in /root/php-amqplib/amqp_wire.inc:317
Stack trace:
#0 /root/php-amqplib/amqp_wire.inc(348): AMQPReader->rawread(1)
#1 /root/php-amqplib/amqp.inc(590): AMQPReader->read_octet()
#2 /root/php-amqplib/amqp.inc(610): AMQPConnection->wait_frame()
#3 /root/php-amqplib/amqp.inc(178): AMQPConnection->wait_channel(0)
#4 /root/php-amqplib/amqp.inc(282): AbstractChannel->next_frame()
#5 /root/php-amqplib/amqp.inc(437): AbstractChannel->wait(Array)
#6 /root/php-amqplib/demo/amqp_publisher.php(9): 
AMQPConnection->__construct('localhost', 5672, 'guestrrr', 'guestrrr', '/')
#7 {main}
  thrown in /root/php-amqplib/amqp_wire.inc on line 317

So it looks like the patch doesn't need to be applied in the version I'm using
and the error is in fact an invalid username/password combination and nothing 
more than that.

Long story short: I changed my config.php to use username & password 
guest/guest for my own code and the error magically disappeared!

Original comment by Sean.Kel...@gmail.com on 31 Jan 2012 at 3:46

GoogleCodeExporter commented 8 years ago
Here another approach.
Replaced (BufferedInput) $this->sock with (resouce) $this->sock->sock, and demo 
work for me.

Original comment by kei...@onoffmix.com on 12 Dec 2012 at 2:55

Attachments: