×


PHP Installation
Errors and Exceptions can be logged by including our error handler which automatically creates a package for your error and submits it to ErrLog.IO.
 Including the Library
The simplest method is to include our PHP library within your project.
<?php
include 'https://relay.errlog.io/php/v1';
?>
 Configuring ErrLog.IO
There are two steps that are required in order to enable ErrLog.IO from PHP.
Configure API Key
<?php
global $api_key;
$api_key = "[Your-api-key]";
?>
Configure Error Handlers
There are two main types of Error Handlers within PHP, the generic Error Handler and an Exception Handler. To add ErrLog.IO to these handlers, we simply pass our method logError to these handlers.
<?php
set_error_handler('logError');
set_exception_handler('logError');
?>
You can learn more about these methods within the official PHP documentation:

set_error_handler   set_exception_handler
 Complete Code Example
<?php
global $api_key;
$api_key = "[Your-api-key]";
set_error_handler('logError');
set_exception_handler('logError');
?>
 Troubleshooting
PHP, by default, doesn't enable the inclusion of remote files using the include directive.
To enable this, your PHP.INI file should be updated to enable remote files.
; Whether to allow include/require to open URLs (like http:// or ftp://) as files.
; http://php.net/allow-url-include
allow_url_include = on
You can learn more about remote files in the official PHP documentation.

 

Discuss this article