The following function works fine locally, but causes a blank page when the function is called on the Ubuntu VM. message_room
is properly define in HipChat.php (again, it works as expected locally).
require 'HipChat.php';
define('HIPCHAT_APIKEY', 'xxx');
define('HIPCHAT_NAME', 'Assets');
define('HIPCHAT_ROOM', 'Assets');
function hipchatDump ($message) {
$hc = new HipChat\HipChat(HIPCHAT_APIKEY);
try {
$hc->message_room(HIPCHAT_ROOM, HIPCHAT_NAME, $message, false, 'yellow', 'text');
} catch (Exception $e) {
echo 'Caught exception: ', $e->getMessage(), "\n";
}
}
The command php --version
produces the following on each machine:
Macbook:
PHP 5.4.17 (cli) (built: Sep 12 2013 23:14:23)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
Ubuntu VM:
PHP 5.5.3-1ubuntu2.1 (cli) (built: Dec 12 2013 04:24:35)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
with Zend OPcache v7.0.3-dev, Copyright (c) 1999-2013, by Zend Technologies
The try/catch is not outputting anything. I've narrowed the issue down to the line:
$hc->message_room(HIPCHAT_ROOM, HIPCHAT_NAME, $message, false, 'yellow', 'text');
From what I can tell, nothing that has changed in PHP5.5 should be causing this to fail based on the PHP version. Any ideas why this works on one machine and not the other?
UPDATE
It appears the initial problem was that cURL was not installed. After installing it and restarting the apache service, the original error in the Apache log file is gone, but now I see this:
[Wed Jan 15 17:14:48.767984 2014] [:error] [pid 5886] [client 172.16.3.77:65381] PHP Fatal error: Call to undefined function HipChat\\json_decode() in /var/www/assets/scripts/php/HipChat/HipChat.php on line 240, referer: http://myurl/
My Ubuntu version is 13.10