"Cannot redeclare function X()" in PHP — What It Means and How to Fix It
What the PHP error "Cannot redeclare function X()" means and how to fix it.
Published October 31, 2026
"Cannot redeclare function X()" occurs when a function with the same name is defined more than once in the same scope.
Key points
- Often caused by including the same file twice — use require_once/include_once instead of require/include