# Fatal error: Maximum function nesting level of '256' reached, aborting!

**Code:** `Maximum function nesting` · **Category:** PHP · **Seen on:** PHP

Recursion went deeper than Xdebug’s max_nesting_level allows (or PHP crashed with a segfault without Xdebug).

## Meaning

The message comes from Xdebug. Without Xdebug, infinite recursion in PHP usually ends in a segmentation fault or memory exhaustion.

## Common causes

- Infinite recursion (missing base case)
- Magic methods calling themselves (__get inside __get)
- Legitimately deep recursion on big trees

## Quick fix

1. Find the repeating frames in the trace
2. Fix the base case
3. Raise `xdebug.max_nesting_level` only for legitimately deep recursion

## Detailed fix by platform

### PHP

1. Convert deep recursion to an iterative loop with an explicit stack

## How to diagnose

1. **Frames** — Which function repeats?
2. **Base case** — Is it ever reached?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/php/stack-overflow-maximum-function-nesting)
