error_reporting(E_ALL ^ E_NOTICE);
// load Redis
require '/path/to/nrk-predis-5859578/autoload.php';
Predis\Autoloader::register();
// connect to Redis server
$redis = new Predis\Client('tcp://127.0.0.1:6379');
// Redis queue key
$QUEUE_KEY = 'list.apns.messagequeue';
// enable log
$_ENABLE_LOG = true;
// path to log
$LOGPATH = '/path/to/logs/';
// Using Autoload all classes are loaded on-demand
require_once '/path/to/ApnsPHP/Autoload.php';
// Instanciate a new ApnsPHP_Push object
$server = new ApnsPHP_Push_Server(ApnsPHP_Abstract::ENVIRONMENT_SANDBOX, '/path/to/apns.pem');
// Set the Root Certificate Autority to verify the Apple remote peer
$server->setRootCertificationAuthority('/path/to/entrust_root_certification_authority.pem');
// Set the number of concurrent processes
$server->setProcesses(4);
// Starts the server forking the new processes
$server->start();
_pushLog(array(date('Y-m-d H:i:s'), 'STARTING SERVER'));
/*
 * Main server run loop
 */
while ($server->run()) {
    $date = date('Y-m-d H:i:s');
    // Check the error queue
    $aErrorQueue = $server->getErrors();
    if (!empty($aErrorQueue)) {