PHP Fatal error: Uncaught Error: Call to undefined function
PHP can’t find the function you called — usually a missing extension, missing include, or namespace issue.
Meaning
If the function is built into a PHP extension (mysqli_connect, curl_init, mb_strlen, imagecreatefromjpeg), the extension isn’t installed/enabled for the PHP version actually running. Otherwise, the file defining it wasn’t loaded or the name/namespace is wrong.
Common causes
- PHP extension not installed or not enabled (mysqli, curl, mbstring, gd, intl)
- CLI and web server use different PHP versions/php.ini
- File with the function not included / autoloaded
- Function removed in newer PHP (e.g.
mysql_connectremoved in PHP 7,each()in PHP 8) - Calling a namespaced function without
use functionor full name
⚡ Quick fix
- Install/enable the extension:
sudo apt install php8.2-curl(match your version) and restart FPM/Apache - Check
phpinfo()from the web server, not justphp -mon CLI - Replace removed functions (
mysql_*→ PDO/mysqli) - Check includes/autoload and namespaces
Detailed fix by platform
PHP
- Find which extension is missing:bash
php -v && php -m | grep -i -E 'curl|mysqli|mbstring|gd|intl' sudo apt install php8.2-curl php8.2-mbstring php8.2-mysql sudo systemctl restart php8.2-fpm
How to diagnose
- Function — Built-in (extension) or yours?
- Runtime — Which PHP version/ini does the web server use?
- Loading — Is the defining file included?
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026