A blank cURL body is a symptom, not a diagnosis. Start with curl -i -v to distinguish an actually empty response from a redirect, HTTP error, or PHP failure. Then watch the Nginx and PHP-FPM logs while repeating the request. In most Nginx/PHP cases, the decisive checks are the PHP location block, the fastcgi_pass endpoint, and whether fastcgi_param SCRIPT_FILENAME resolves to the real, readable script beneath the active root.
Antihost offers Linux VPS plans with full root access, unlimited traffic on a 1 Gbps port and a 14-day free trial.
What a “blank page” can actually mean
Seeing no text in a terminal or browser does not identify the failing layer. The server may have returned a successful status with a zero-length body, redirected you elsewhere, rejected the request before PHP ran, or executed PHP that failed before producing output. Treat the empty-looking page as an observation to classify.
As an Amazon Associate I earn from qualifying purchases.
| What you observe | Most useful interpretation |
|---|---|
200 OK with a zero-length body |
PHP may have terminated without output, or the application may have hit a fatal error that is visible only in logs. |
301 or 302 |
The request was redirected. Inspect the Location header, scheme, host and application URL settings. |
404 before PHP runs |
Nginx routing, location matching, index or try_files is deciding the result. |
502 Bad Gateway |
Nginx cannot successfully communicate with the configured PHP-FPM endpoint. |
| PHP source appears as text or downloads | The PHP location was not selected, or it is serving the file statically instead of sending it to FastCGI. |
| A response with PHP content type but no visible text | The request reached the PHP path; inspect PHP-FPM and application errors rather than changing browser settings. |
1. Inspect the response on the wire
Use a request that displays status, headers, connection details and the response body together:
curl -i -v https://example.test/file.php
The -i option includes response headers in the output. The -v option shows the request and connection exchange, including TLS and redirect clues. Record the status code, every Location header, the Content-Length value when present, the content type and whether any body bytes follow the headers.
#1 Best Overall
For a local virtual host, send the host name explicitly so Nginx chooses the intended server block:
curl -i -v -H 'Host: example.test' http://127.0.0.1/file.php
This is especially important when the public DNS name is not pointed at the machine yet or when several virtual hosts share one address. A headers-only probe such as curl -I can confirm metadata, but it cannot show whether the normal GET body is empty; use -i -v for the main diagnosis.
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 problemsFollow redirects only after recording the first response
Do not begin with -L. Following redirects can hide the original status and make a host, HTTPS or application-URL problem look like a blank PHP response. First capture the un-followed response and its Location target. Once the redirect is understood, curl -i -v -L can show the complete chain.
2. Watch Nginx and PHP-FPM logs during one request
Open separate terminals, start watching the configured Nginx access and error logs and the PHP-FPM or application error log, then issue exactly one cURL request. Correlating one request with the log entries prevents unrelated traffic from misleading you.
Nginx identifies access.log and error.log as its primary troubleshooting files, but their locations and names depend on the distribution and active configuration. Inspect the loaded configuration and service unit rather than assuming a path. The PHP-FPM pool may log to a separate file, the system journal or the application’s own log.
Useful messages include:
- “Primary script unknown” or “No input file specified.” The path passed in
SCRIPT_FILENAMEdoes not identify a file PHP-FPM can open. - Permission denied. The file may be readable only by your login account, or one of its parent directories may not be traversable by the PHP-FPM worker.
- Upstream connection errors. Nginx cannot reach the socket or TCP endpoint named by
fastcgi_pass. - Worker crashes, timeouts or pool errors. PHP-FPM is unhealthy, overloaded or terminating requests before output is returned.
- Application fatal errors. The framework or script reached PHP and failed during bootstrap, configuration loading or output generation.
Logs are more reliable than what a browser displays. A production configuration commonly suppresses on-screen PHP errors, so an apparently successful response can still correspond to a fatal error recorded server-side.
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 →3. Validate the Nginx PHP location block
The PHP location must do two separate jobs: select PHP requests and pass them to the intended PHP-FPM process with the correct script path. A minimal pattern is:
Rank #2
location ~ .php$ {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/run/php/php-fpm.sock;
}
The exact socket name is distribution- and PHP-version-specific. Treat the example as a pattern, not a path to copy blindly. Verify which PHP-FPM service is running, which pool it uses and whether the socket named by fastcgi_pass exists. A TCP endpoint such as localhost:9000 is also valid when PHP-FPM is configured to listen there.
Confirm the active document root
Nginx’s root must point to the directory that actually contains the requested script. For a request for /file.php, the expression $document_root$fastcgi_script_name should resolve to the real filesystem path for that file. It must not point into an old release directory, a different container, a second virtual host or a directory that exists only on the Nginx side.
Nginx documentation defines SCRIPT_FILENAME as the parameter PHP uses to determine the script name. If it is wrong, PHP-FPM can report a missing input file even though the URI looks correct in the browser.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteCheck which location actually wins
A different regex or prefix location can intercept the request before the PHP block. Review the loaded configuration, including included files, and verify that the requested URI selects the block containing fastcgi_pass. If PHP source is downloaded or displayed as text, this selection check is urgent: the file is being handled as static content instead of executed.
4. Prove the mapped file exists and is readable
After calculating the path Nginx should send, test that exact path on the server. Confirm all of the following:
- The script exists at the computed location and has the expected name and case.
- The Nginx/PHP-FPM user can read the file.
- That user can traverse every parent directory.
- A symlink does not point outside a permitted filesystem path.
- The path is identical inside any container or chroot used by PHP-FPM.
A wrong root, an extra slash, a release-directory mismatch, a symlink target that is unavailable to the worker, or separate container filesystems can all produce a blank-looking result whose explanation appears only in the logs.
Use try_files as an existence gate
Nginx can check for the PHP file before handing the request to FastCGI. The documented purpose of try_files in this pattern is to verify the PHP file’s existence before forwarding it. This turns a path mistake into a clear routing result instead of sending a nonexistent script upstream.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Apply the check consistently with your application’s routing model. A front-controller framework may intentionally send many non-file URIs to index.php; blindly adding =404 can break that design. For a site that expects direct PHP files, rejecting a missing script before FastCGI is usually the safer behavior.
5. Confirm the FastCGI endpoint and PHP-FPM service
fastcgi_pass must reach the live PHP-FPM socket or TCP listener for the PHP version and pool that should execute the site. Check the endpoint in the Nginx configuration against the running service rather than assuming the name from an old deployment.
- Verify the PHP-FPM service is running and has not failed on startup.
- Verify the Unix socket exists, or that the configured TCP listener is bound and reachable.
- Check socket ownership and permissions; Nginx must be allowed to connect.
- Make sure Nginx and PHP-FPM are using the same filesystem view when containers, chroots or separate hosts are involved.
- After changing the configuration, validate it and reload Nginx, then repeat the same cURL request while watching logs.
A transport failure normally produces 502 Bad Gateway, but the log entry is the decisive evidence. Changing PHP code cannot repair a dead or inaccessible FastCGI endpoint.
6. Separate Nginx/FPM execution from application failure
Create a temporary, controlled script in the document root:
Recommended Free Tools
<?php
header('Content-Type: text/plain');
echo "php-okn";
Request that file directly with cURL. Remove it immediately after testing.
If the diagnostic file returns php-ok
The Nginx location, FastCGI transport and basic PHP execution path are working. Concentrate on the original application: bootstrap code, environment configuration, dependency loading, database initialization, template rendering and any fatal error recorded in the PHP-FPM or application log. The blank response is then an application-output problem, not a generic Nginx handler failure.
If the diagnostic file is also blank or fails
Stay at the infrastructure layer. Recheck the selected Nginx location, the calculated SCRIPT_FILENAME, file and directory permissions, the PHP-FPM endpoint and the service logs. Do not spend time debugging framework code until this direct script executes and returns visible text.
Rank #4
7. Treat invisible PHP errors as a logging problem
PHP’s display_errors setting controls whether errors are written into the response shown to the client. It may be disabled in production, and changing it at runtime with ini_set() does not necessarily affect fatal errors: a script that fails fatally can terminate before that runtime setting takes effect. Consequently, a fatal error can accompany an empty body and a status that does not immediately reveal the cause.
Free tools Windows power users keep installed
One-click scans. No signup required.
Use server-side error logging as the reliable channel. In a non-production environment, you may temporarily enable verbose display to speed development diagnosis, but revert it after the test. Never make customer-facing error display your production strategy; configure, collect and monitor PHP-FPM and application logs instead.
8. Verify the parameters passed to PHP
The FastCGI include is responsible for passing the request metadata PHP needs, not just the script path. In addition to SCRIPT_FILENAME, confirm that the active parameter file supplies the request method, query string and content metadata required by the application. Nginx’s FastCGI documentation specifically describes QUERY_STRING and the parameters needed for POST handling.
A query string belongs to the request data; it should not be manually concatenated onto the filesystem path in SCRIPT_FILENAME. If a GET request works but a form submission appears empty, compare the request method and content parameters reaching PHP and inspect the application log for its handling of the input. Keep the distribution’s working fastcgi_params or equivalent include unless you have a documented reason to replace it.
Common symptoms mapped to the right fix
| Symptom | Likely layer | Fix to test |
|---|---|---|
200 OK with a zero-length body and a PHP-FPM fatal error |
PHP application | Fix the fatal error and inspect PHP-FPM/application logs; do not rely on display_errors. |
| Nginx reports “Primary script unknown” or a missing input file | Path mapping or filesystem | Correct root and SCRIPT_FILENAME; verify the resulting file exists and is readable. |
502 Bad Gateway |
FastCGI transport | Check fastcgi_pass, PHP-FPM service state, socket permissions, endpoint path and timeouts. |
404 before PHP runs |
Nginx routing | Check location matching, try_files, index and the requested URI. |
Redirect loop or unexpected 301/302 |
HTTP or application routing | Use curl -i -v to inspect Location; verify scheme, host and application URL settings. |
| PHP source downloaded or shown as text | Nginx handler | Ensure the PHP location is selected and uses fastcgi_pass; never serve PHP source as static content. |
A production-safe troubleshooting order
The following order minimizes guesswork and avoids risky changes:
- Run
curl -i -vagainst the exact URL, adding the correctHostheader for a local virtual host. - Classify the result as redirect, HTTP error, zero-length success or source download.
- Watch Nginx access/error logs and PHP-FPM/application logs while repeating one request.
- Inspect the loaded Nginx PHP location and confirm the active
root. - Calculate the
SCRIPT_FILENAMEpath and verify the file, parent directories and permissions. - Confirm the
fastcgi_passsocket or TCP listener belongs to the intended PHP-FPM service and pool. - Use
try_fileswhere it fits the application’s routing model. - Run the temporary
php-okscript, then delete it. - Only after the direct script works, debug application bootstrap and output code.
- Keep detailed errors in server-side logs and limit visible error output to controlled development testing.
Configuration changes that commonly make things worse
- Guessing a socket path. Socket names change with distribution and PHP version. A plausible-looking path that is not the live endpoint causes transport failures.
- Changing
display_errorsand stopping there. Fatal errors may occur before a runtime setting takes effect, and production clients should not receive stack traces. - Adding a blanket
=404totry_files. This can break front-controller applications that route non-file requests throughindex.php. - Testing only through a browser. Browsers hide or follow redirects and often omit the precise headers needed to classify the failure.
- Fixing PHP code before proving direct execution. If the diagnostic script cannot return text, the problem is still in routing, path mapping, permissions or FastCGI transport.
- Assuming a shared filesystem. Nginx and PHP-FPM may run in different containers or release directories; a path valid to one process may not exist for the other.
- Editing every FastCGI parameter by guesswork. Replacing a working include can drop the query string, request method or content metadata that POST requests require.
What a successful diagnosis looks like
A fixed setup produces a predictable chain: cURL reaches the intended virtual host; Nginx selects the PHP location; try_files and the active root identify the requested file; SCRIPT_FILENAME resolves to that readable file; fastcgi_pass reaches the running PHP-FPM pool; and PHP either returns application output or records a specific error in its log. When one link fails, the status and the corresponding log entry identify which layer to repair.
Frequently Asked Questions
Why does cURL show 200 OK but no body?
A 200 response can still contain zero bytes if the script produces no output or terminates on a fatal error before output. Check the PHP-FPM and application logs while repeating the request; do not treat 200 as proof that PHP completed normally.
Best Value
How can I check whether SCRIPT_FILENAME is wrong?
Combine the active Nginx root with the requested script name and compare that filesystem path with the real file. Confirm the PHP-FPM worker can read it and traverse its parent directories. “Primary script unknown” or “No input file specified” strongly supports a mapping problem.
Where should I look for Nginx and PHP errors?
Watch the configured Nginx access and error logs plus the PHP-FPM pool or application log during one request. Paths vary by distribution and service unit, so inspect the loaded configuration and journal instead of assuming a universal filename.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →What does a 502 response mean in this situation?
It usually indicates a FastCGI transport problem: PHP-FPM may be stopped, the socket or TCP address may be wrong, or Nginx may lack permission to connect. Verify the live endpoint and service state before changing PHP code.
Should I add try_files to every PHP location?
Use it when you want Nginx to verify a direct PHP file before forwarding it. Match the rule to the application’s routing model; a blanket 404 can break front-controller applications that intentionally route requests through index.php.
Why does enabling display_errors not reveal the fatal error?
display_errors may be disabled by production configuration, and a runtime ini_set change may occur too late when a fatal error prevents the script from continuing. Server-side PHP-FPM or application logging is the dependable diagnostic channel.
Is curl -I enough to diagnose an empty page?
No. curl -I sends a headers-only probe and cannot show whether a normal GET returned body bytes. Use curl -i -v first so you can inspect the status, redirects, headers and actual response body together.
What should I do if a small php-ok file works but the application is blank?
The Nginx location, FastCGI connection and basic PHP execution path are functioning. Focus on application bootstrap, environment and dependency loading, database initialization, rendering, and the fatal error or other message recorded in the application log.
The Bottom Line
Classify the response with curl -i -v, correlate one request with Nginx and PHP-FPM logs, then verify the selected PHP location, active root, computed SCRIPT_FILENAME and live fastcgi_pass endpoint. A temporary php-ok script cleanly separates infrastructure failures from application failures. Keep detailed errors in server-side logs and expose them to clients only during controlled development testing.
Quick Recap
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.




