“PHP issues” are not one problem. Most failures originate in one of six layers: PHP syntax and runtime, configuration and extensions, Composer dependencies, web-server/PHP-FPM integration, framework or application code, or infrastructure such as permissions, databases and external services. Start by classifying the symptom, recording the exact environment, checking logs, and making one controlled change at a time. Do not begin by hiding errors, raising every limit, or running composer update on production.
PHP Issues: How to Diagnose and Fix Them
Classify the symptom before changing code
| Symptom | Most likely layer |
|---|---|
Parse error or unexpected token |
Syntax, PHP version, or unsupported language feature |
Call to undefined function |
Missing extension, wrong SAPI, disabled function, or typo |
Class not found |
Composer autoloading, namespace, case mismatch, or missing package |
Allowed memory size exhausted |
Memory limit, large data set, recursion, leak, or runaway query |
| Blank page or HTTP 500 | Hidden fatal error, PHP-FPM failure, permissions, or web-server configuration |
| Works in CLI but not in a browser | Different PHP binary, php.ini, SAPI, environment, or permissions |
| Composer dependency conflict | Version constraints, platform PHP version, missing extension, lock file, or package conflict |
| Database connection failure | Credentials, host or socket, driver, TLS, firewall, DNS, or environment configuration |
| Permission denied | Ownership, directory permissions, SELinux/AppArmor, or deployment user |
| Slow requests | Database, external API, filesystem, PHP-FPM saturation, opcode cache, or application logic |
| Debugger cannot connect | Xdebug mode, port, IDE key, path mapping, firewall, or runtime mismatch |
The first-response diagnostic workflow
1. Preserve the exact failure
- Copy the complete error, HTTP status, URL or CLI command, timestamp, and request ID.
- Record the PHP version, SAPI, framework and application versions, and whether the failure is in a browser, queue worker, cron job, CLI command, or deployment.
- Note recent code, dependency, configuration, infrastructure, or hosting changes.
Do not suppress the message or alter several settings simultaneously. A reproducible before-and-after comparison is more valuable than a speculative fix.
2. Identify the interpreter and configuration
php -v
which php
php --ini
php -m
php -i | grep -E 'memory_limit|error_reporting|display_errors|log_errors'
On Windows, use:
php -v
where php
php --ini
php -m
These commands describe the CLI installation. A browser request may instead use Apache’s module, PHP-FPM, FastCGI, a container, or a hosting-panel runtime. A temporary file containing <?php phpinfo(); can expose the web SAPI’s version, extensions and settings; protect it from public access and delete it immediately after diagnosis.
3. Read logs before changing settings
- PHP and PHP-FPM error logs
- Nginx or Apache error logs
- Framework and queue-worker logs
- Container, platform and deployment logs
- Database and external-service logs
Keep detailed errors server-side in production. Use display_errors=Off, log_errors=On, redaction, access-controlled logs, request IDs, and a generic public error page.
Recommended Free Tools
#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
4. Reduce the failure
Check whether it affects one route or every route, one user or all users, one input, only post-deployment traffic, only load, or only a particular execution mode. Temporarily disabling one plugin, middleware, package, or extension in a safe environment can identify the layer.
5. Make one controlled change and retest
Reproduce locally or in staging where possible. Deploy the smallest version-controlled change, test in the same runtime that failed, and record what actually resolved the incident.
A 10-minute checklist
- Capture the exact message and request context.
- Check PHP, web-server, framework and application logs.
- Confirm the PHP version and SAPI.
- Confirm the active
php.ini. - Check required extensions.
- Inspect Composer’s lock file and installed packages.
- Build a minimal reproduction.
- Compare local, staging and production environments.
- Apply one reversible change.
- Retest the original request and document the result.
Common PHP errors and practical fixes
Parse errors
Missing punctuation, an unterminated string, or an unmatched brace is common. Another frequent cause is deploying PHP 8 syntax to a PHP 7 runtime, or sending a file to the wrong interpreter. Run:
php -l path/to/file.php
Inspect the reported line and the preceding lines; the parser often notices the problem after the character that caused it.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Fatal errors and uncaught exceptions
A fatal error stops execution. An uncaught exception means code threw an exception without an appropriate handler. Warnings may allow execution to continue but still indicate a defect; deprecations warn about future incompatibility.
try {
$result = $service->run();
} catch (Throwable $e) {
error_log((string) $e);
throw $e;
}
Catch an exception only to recover or add useful context. Do not catch every Throwable merely to hide a failure; let the framework or process supervisor handle unrecoverable errors.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
“Call to undefined function”
Check for a missing extension, an extension enabled only for CLI, a wrong PHP version, a typo, a hosting policy, or an assumption that an optional extension exists.
php -m
php --ri curl
php --ri mysqli
php --ri pdo_mysql
Check the browser-facing SAPI separately. A successful CLI result does not prove that PHP-FPM or Apache loaded the same modules.
“Class not found” and autoloading
Typical causes include a missing package, stale autoload files, a namespace or capitalization error, a file omitted from Composer’s autoload rules, a deployment without vendor/, or production code depending on a package installed only as a development dependency.
composer validate
composer dump-autoload -o
composer show vendor/package
When a lock file is committed, deployments should normally run composer install, not an unplanned composer update. On case-sensitive filesystems, class and path capitalization must match exactly.
Memory exhaustion
First determine whether the workload is legitimate or whether code is accumulating data, recursing, loading an enormous query result, processing a large file, or retaining objects in a long-running worker.
- Paginate or chunk database reads.
- Stream large files and images.
- Release large temporary values.
- Profile CPU and memory before changing limits.
- Use controlled worker restarts and process-level memory limits where appropriate.
Increase memory_limit only when the workload is understood and the host has capacity. Never use ini_set('memory_limit', '-1') as a general production fix.
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
Blank pages and HTTP 500 responses
- Read PHP and web-server logs.
- Confirm the request reached PHP-FPM or Apache.
- Check FPM status, pool and worker logs.
- Enable detailed errors only in a protected development environment.
- Check ownership, permissions and environment variables.
- Compare the latest deployment and configuration changes.
- Reproduce with a CLI command or minimal route if possible.
Likely causes include a hidden fatal error, malformed FPM configuration, missing variables, incompatible extensions, exhausted workers, or a framework boot failure.
Database connection failures
- Verify credentials, database name and environment-variable loading.
- Inside a container, use the database service name rather than the host’s
localhost. - Distinguish a Unix socket from TCP and confirm the expected port.
- Check
pdo_mysql,pdo_pgsql, or the relevant driver. - Test DNS, firewall or security-group rules, TLS certificates and server bind addresses.
- Check connection limits and whether cron or workers receive the same configuration as web requests.
Test from the same host or container, OS user and runtime as the application—not only from a developer laptop.
Permissions, uploads and limits
The web worker may be unable to write uploads, cache, sessions or temporary files. Deployment can change ownership; Linux case sensitivity can expose path mistakes; SELinux or AppArmor can deny access despite apparently correct Unix modes.
Grant write access only to required directories. Do not make the entire application world-writable. For failed uploads, compare upload_max_filesize, post_max_size, max_file_uploads, web-server limits and temporary-directory permissions.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsSlow requests
Measure rather than guess. Inspect database queries, external APIs, filesystem operations, PHP-FPM queueing, opcode-cache status and application loops. A profiler or APM trace can distinguish application CPU from waiting on a service.
PHP version and compatibility issues
As of August 18, 2026, PHP’s supported branches are:
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
| Branch | Initial release | Active support ends | Security support ends | Status on August 18, 2026 |
|---|---|---|---|---|
| 8.2 | December 8, 2022 | December 31, 2024 | December 31, 2026 | Security fixes only |
| 8.3 | November 23, 2023 | December 31, 2025 | December 31, 2027 | Security fixes only |
| 8.4 | November 21, 2024 | December 31, 2026 | December 31, 2028 | Active support |
| 8.5 | November 20, 2025 | December 31, 2027 | December 31, 2029 | Active support |
See the official PHP support table for updates. “Supported” does not mean “actively supported”: security-only branches receive fewer fixes. PHP’s migration guide, PHP 8.2 migration notes and migration documentation list incompatible changes, deprecations and removed extensions.
Compare every execution context:
php -v
php --ini
php -r 'echo PHP_SAPI, PHP_EOL;'
php -r 'echo PHP_VERSION, PHP_EOL;'
php-fpm8.5 -v
The FPM binary name varies by operating system. Also compare Apache modules, container images, hosting-panel settings, queue workers, cron and CI. A framework can require a narrower range than PHP itself. Laravel 13 documents PHP 8.3–8.5; Laravel 12 supports 8.2–8.5; Laravel 11 supports 8.2–8.4 and reached the end of security support on March 12, 2026. Check the version-specific Laravel release table rather than assuming the newest PHP works with every framework.
Composer dependency and autoloading problems
Run the least destructive diagnostics first:
composer --version
composer diagnose
composer validate
composer show
composer show vendor/package
composer why-not vendor/package target-version
composer prohibits vendor/package target-version
composer install -vvv
diagnose checks common Composer and environment problems; validate checks project metadata; why-not and prohibits reveal constraints blocking a target version. Use verbose output only when needed because it can expose paths, URLs or environment details. The Composer troubleshooting guide also recommends updating Composer, checking the installer, clearing cache and rebuilding dependencies when appropriate:
composer clear-cache
composer dump-autoload -o
- The project may require a package incompatible with the installed PHP platform.
- Two packages may require incompatible versions of a shared dependency.
- An extension may be missing.
- The lock file may have been generated under a different PHP version.
- A private repository, branch, stability setting or package name may be wrong.
For reproducible production deployments, commit composer.lock and run composer install. Treat composer update as a deliberate dependency-resolution operation: review its lock-file changes, test them under the production PHP version, and deploy through version control. Do not casually delete a working lock file or copy an unreviewed vendor/ directory between incompatible environments.
PHP-FPM, Nginx and Apache failures
A 502 Bad Gateway, connection refusal or timeout often means the web server cannot reach a healthy FPM pool. Check:
- Whether the FPM service is running.
- Whether Nginx points to the correct socket or TCP port.
- Socket ownership and permissions.
- The pool’s worker and request limits.
- Nginx
fastcgi_param SCRIPT_FILENAMEand document root. - Whether Apache or Nginx forwards to a different PHP version than CLI.
- Timeouts, slow requests and exhausted workers.
Changing php.ini cannot repair a stopped FPM service, a wrong socket path or an incorrect FastCGI parameter. Restart only the affected service after checking its configuration and logs, and verify the original URL afterward.
Free tools Windows power users keep installed
One-click scans. No signup required.
Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Framework and Laravel-specific failures
Framework-neutral checks still apply: confirm the runtime, extensions, environment variables, Composer state, logs and writable directories. Laravel incidents commonly involve stale configuration, route or view caches; missing .env values; an incorrect APP_KEY; unapplied migrations; storage-link problems; old queue workers; or permissions on storage and cache directories.
- Use cache-clearing and rebuild commands in development or a planned deployment, not as an improvised production experiment.
- Determine which cache was removed and rebuild it with the documented command.
- Restart long-running workers after code or configuration changes so they do not retain stale state.
- Back up production data before migrations and verify that the migration is reversible where possible.
- Check the framework’s PHP range before upgrading either Laravel or PHP.
Laravel Cloud can reduce infrastructure and deployment work, but it cannot correct incompatible code or dependency constraints. The same distinction applies to any managed host.
Debuggers, logs and monitoring
| Tool | Best use | Limitation |
|---|---|---|
| Structured logs | Low-cost context, audit trails and incident timelines | Require useful fields, retention and redaction |
| Xdebug with an IDE | Stepping through deterministic local or staging code | Needs matching interpreter, port, IDE key and path mappings |
| Error tracking | Grouped exceptions, stack traces, releases and user impact | Event volume, privacy and retention must be controlled |
| APM | Latency, database calls, queues, external services and distributed traces | More cost and operational complexity |
| Profiler | CPU and memory hotspots | Can be intrusive and is usually used selectively |
If Xdebug does not connect, verify that it is installed for the failing SAPI, the mode is enabled, the client host and port match, the IDE key is correct, path mappings are accurate, and firewalls allow the connection. PhpStorm’s debugging troubleshooting guide recommends checking the configured interpreter, php.ini, logs and mappings. IDE language-level support is not proof that a production runtime, framework or extension is compatible; see PhpStorm’s supported PHP versions.
When a paid product is justified
- Local code debugging: PhpStorm or a free editor with Xdebug.
- Production exception visibility: Sentry’s pricing page and Laravel SDK provide the starting points; scrub secrets and personal data.
- Full-stack diagnosis: New Relic covers PHP, infrastructure, logs and traces. Its pricing page lists a 100 GB monthly ingest free tier, $0 basic users, $49 core users, and edition-dependent full-platform pricing; confirm current regional terms in the usage-plan documentation.
- Managed Laravel operations: Laravel Cloud lists Starter at $5 per month plus usage, Growth at $20 plus usage, Business at $200 plus usage and custom Enterprise pricing; its pricing page and documentation should be checked before purchase.
Paid monitoring adds recurring cost, data-retention limits, ingest or event charges and compliance obligations. Logs and Xdebug may be sufficient for a small application.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Should you upgrade PHP or patch the application?
| Upgrade now or soon | Stage or delay |
|---|---|
| The branch is unsupported or near end of life. | Abandoned packages or unavailable vendor extensions block compatibility. |
| Dependencies support the target branch and security policy requires it. | Tests do not cover important production behavior. |
| Testing demonstrates compatibility and rollback is reliable. | The framework has a narrower range or the code has many deprecations. |
| An obsolete extension or runtime behavior causes the issue. | The deployment cannot restore the last known-good runtime. |
- Create a branch and inventory PHP, framework, extensions, Composer packages, workers and cron jobs.
- Read migration notes for every skipped PHP version.
- Run automated tests, static analysis and deprecation checks.
- Test web, CLI, queues, cron, uploads, database drivers and external integrations.
- Deploy progressively with health checks and a tested rollback.
Raising a limit is appropriate only after measuring the workload, confirming available memory, applying the setting to the correct SAPI and adding recurrence monitoring. Fix unbounded data, recursion, leaks and inefficient queries instead.
Quick Recap
Prevent recurring PHP issues
- Keep PHP and framework branches within their support windows.
- Commit
composer.lockand usecomposer installfor reproducible deployments. - Run CI against every supported PHP version and required extension set.
- Use static analysis, automated tests and deprecation checks before upgrades.
- Record runtime, SAPI, configuration and dependency versions in deployments.
- Add health checks for PHP-FPM, databases, queues and critical external services.
- Use structured logs, request IDs and error aggregation with secret and personal-data redaction.
- Document ownership, writable directories, cache rebuilds, worker restarts and rollback steps.
- Set worker and container memory limits and alert on FPM saturation, error rates and latency.
Quick reference
| Question | Command or check |
|---|---|
| Which PHP is CLI using? | php -v, which php or where php |
| Which configuration is active? | php --ini |
| Which extensions are loaded? | php -m, php --ri extension |
| Does a file parse? | php -l path/to/file.php |
| What is the SAPI? | php -r 'echo PHP_SAPI, PHP_EOL;' |
| Is Composer metadata valid? | composer validate |
| Why cannot a package upgrade? | composer why-not vendor/package target-version |
| Are autoload files current? | composer dump-autoload -o |
| What is the active memory limit? | php -r 'echo ini_get("memory_limit"), PHP_EOL;' |
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

