v1

latestOpenAPI 3.0.2cPanel License2026-08-06657427.1 MB
LogManager
Logs

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).

get/LogManager/view_error_log

Query parameters

domainstring required

A domain owned by the current cPanel user.

file_id'php_fpm_error_log' | 'docroot_error_log' | 'homedir_error_log' 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.
limitinteger

The number of lines to retrieve from the end of the log file.

Note:

Values above 5000 are silently capped at 5000.

Response

HTTP Request was successful.

apiversioninteger

The version of the API.

funcstring

The name of the method called.

modulestring

The name of the module called.

Example response

{
  "apiversion": 3,
  "func": "view_error_log",
  "module": "LogManager",
  "result": {
    "data": {
      "file_id": "php_fpm_error_log",
      "log_content": [
        "[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"
      ],
      "lines_read": 2,
      "modified_today": 1,
      "mtime": 1778112083,
      "path": "/home/cpuser/logs/example_com.php.error.log",
      "size": 4096
    },
    "metadata": {
      "transformed": 1
    },
    "status": 1
  }
}