Search code examples
phpubuntufatal-erroropenfirexmpphp

XMPPHP to Openfire


(This is my first ever question so please excuse the noobness)

I have a Ubuntu VPS from DigitalOcean that I have Openfire installed and running. I'm trying to use XMPPHP to send alerts but it doesn't send the message.

My Code:

include("../XMPPHP/XMPP.php");
$conn = new XMPPHP_XMPP('***.***.***.***', 5222, 'alert', 'password', 'xmpphp', '***.***.***.***', $printlog=false, $loglevel=XMPPHP_Log::LEVEL_INFO);
$conn->useEncryption(false);
$conn->connect();
$conn->processUntil('session_start');
$conn->presence("Ya, I'm online","available","aim.***.***.***.***");
$conn->message('user@***.***.***.***', "Whoah!");
$conn->disconnect();

Error: Fatal error: Maximum execution time of 30 seconds exceeded in /var/www/html/XMPPHP/Log.php on line 86

More Detailed Logs

1412738973 [INFO]: Connecting to tcp://***.***.***.***:5222 1412738973 [INFO]: Attempting Auth... 
1412738973 [INFO]: Trying DIGEST-MD5 (available : DIGEST-MD5,PLAIN) 1412738973 [INFO]: Auth success! 
1412738973 [INFO]: Bound to alert@***.***.***.***/xmpphp 1412738973 [INFO]: Session started Fatal error: Maximum execution time of 30 seconds exceeded in /var/www/html/XMPPHP/Log.php on line 86

I have this same code working just fine on Openfire installed on CentOS at work but my current setup is on Ubuntu. Not sure if that would make a difference. I was getting encryption failed error so it's been disabled.

If I don't disable it in the script, I get this error

[INFO]: Starting TLS encryption Warning: stream_socket_enable_crypto(): SSL: crypto enabling timeout in /var/www/html/XMPPHP/XMPP.php on line 525 Fatal error: Maximum execution time of 30 seconds exceeded in /var/www/html/XMPPHP/XMLStream.php on line 466

All I know so far is that it connects, authenticates then starts the session and on presence it gets stuck. I have tried many variations of ports, server names etc

Ubuntu: 12.04.5 LTS PHP: 5.3.10 Openfire: 3.9.3

Not sure where to go or what to do. Please advise as to what I can try to resolve this issue.

Thanks so much in advance.


Solution

  • $conn->presence("Ya, I'm online","available","aim...*.*****");

    I didn't need the AIM part in my server address.

    Everything's working fine now.