# Return PHP error log for a domain

This function reads the trailing lines of a single PHP error log
file for a domain owned by the current cPanel user and returns
them in chronological order (oldest first).

Endpoint: GET /LogManager/view_error_log
Version: 11.137.9999.106
Security: BasicAuth

## Query parameters:

  - `domain` (string, required)
    A domain owned by the current cPanel user.
    Example: "example.com"

  - `file_id` (string, required)
    Which of the three well-known log locations to read.

* php_fpm_error_log — The PHP FPM error log. This file is located in the logs/ directory within the cPanel account's home directory.
* docroot_error_log — The PHP error log. This file is located in the domain's document root directory.
* homedir_error_log — The cPanel account PHP error log. This file is located in the cPanel account's home directory.
    Enum: "php_fpm_error_log", "docroot_error_log", "homedir_error_log"

  - `limit` (integer)
    The number of lines to retrieve from the end of the log file.

Note:

Values above 5000 are silently capped at 5000.
    Example: 100

## Response 200 fields (application/json):

  - `apiversion` (integer)
    The version of the API.
    Example: 3

  - `func` (string)
    The name of the method called.
    Example: "view_error_log"

  - `module` (string)
    The name of the module called.
    Example: "LogManager"

  - `result` (object)

  - `result.data` (object)
    An object describing the requested log file
and its content.

  - `result.data.file_id` (string)
    The identifier of the log file that was
read. Same value as the file_id input
parameter.

* php_fpm_error_log — The PHP FPM error log. This file is located in the logs/ directory within the cPanel account's home directory.
* docroot_error_log — The PHP error log. This file is located in the domain's document root directory.
* homedir_error_log — The cPanel account PHP error log. This file is located in the cPanel account's home directory.
    Enum: "php_fpm_error_log", "docroot_error_log", "homedir_error_log"

  - `result.data.log_content` (array)
    The end of the error log file in chronological order.

Note:

This array will return an empty value if the log file is empty.
    Example: ["[07-May-2026 00:01:23 UTC] PHP Warning: Use of undefined constant FOO","[07-May-2026 00:02:47 UTC] PHP Fatal error: Allowed memory size exhausted"]

  - `result.data.lines_read` (integer)
    The number of lines returned in the log_content return's value.
    Example: 2

  - `result.data.modified_today` (integer)
    Whether the log file was modified today. The function determines the time and date with the cPanel & WHM server's time.

* 1 — The file was modified today.
* 0 — The file was not modified today.
    Enum: 1, 0

  - `result.data.mtime` (integer)
    The log file's last-modified time, in Unix time format.

Note:

This return value is determined via a fstat system call on the log file.
    Example: 1778112083

  - `result.data.partial` (integer)
    Whether the log file contains more lines than the limit parameter's value.

* 1 — The file exceeds the limit parameter's value.
* 0 — The file did not exceed the limit parameter's value.
    Enum: 1, 0

  - `result.data.path` (string)
    The absolute path to the log file on disk.
    Example: "/home/cpuser/logs/example_com.php.error.log"

  - `result.data.size` (integer)
    The log file's size, in bytes.

Note:

This return value is determined via a fstat system call on the log file.
    Example: 4096

  - `result.errors` (array,null)
    List of errors if the API failed.

  - `result.messages` (array,null)
    List of messages generated by the API.

  - `result.metadata` (object)

  - `result.metadata.transformed` (integer)
    Post-processing may have transformed the data.
    Enum: 1

  - `result.status` (integer)
    * 1 — Success.
* 0 — Failed. Check the errors field for more details.
    Enum: 1, 0

  - `result.warnings` (array,null)
    List of warnings generated by the API. Warnings describe non-critical failures or other problematic conditions noted while running an API.


