iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
Need a server to try this on? Antihost offers Linux VPS plans with NVMe storage, full root access and a 14-day free trial.
“Unable to open primary script” means PHP-FPM received a filesystem path that it could not open. In most cases, Nginx built the wrong SCRIPT_FILENAME from the active root, alias, URI, or include file. “No such file or directory” points to a path or filesystem-view mismatch; “Permission denied” points to directory traversal, file permissions, or mandatory access control.
Find the exact path in the Nginx error log, determine which location and FastCGI parameters won the request, then test that path from the PHP-FPM pool user’s filesystem view. The sections below provide a repeatable fix for ordinary document roots, aliases, path-info routing, and chrooted pools.
What the error actually means
Nginx does not execute PHP itself. A matching PHP location sends a FastCGI request to PHP-FPM and includes a parameter named SCRIPT_FILENAME. PHP-FPM uses that parameter as the script’s absolute pathname. A common construction is:
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
$document_root is the value of the selected root directive. $fastcgi_script_name comes from the request URI and can include an index filename when fastcgi_index applies. The concatenated result must be the path that the FPM worker can see and open.
#1 Best Overall
- Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
- With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
- Wide Application:Upgraded attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
- Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
- Warranty & Support: Our Electric air duster comes with 5 years warranty and 24/7 customer service. During this period, if you have any questions,pls kindly feel free to contact us.
For a request for /index.php, a root of /var/www/site produces /var/www/site/index.php. If Nginx instead sends /var/www/html/var/www/site/index.php, or sends a host path that is outside an FPM chroot, PHP-FPM reports the primary-script failure even when a similarly named file exists elsewhere.
| Log suffix | What it usually indicates | First checks |
|---|---|---|
No such file or directory |
The path sent in SCRIPT_FILENAME does not exist from the worker’s view. |
root/alias, duplicated prefixes, URI-to-file mapping, fastcgi_index, path-info handling, and chroot. |
Permission denied |
The path exists or is being resolved, but the worker cannot traverse a directory or read the script, or a mandatory-access-control policy blocks it. | Pool identity, execute permission on every parent directory, file-read permission, and AppArmor/SELinux policy. |
The wording after the colon is important. Always diagnose the complete path and suffix shown in the error log rather than treating every “No input file specified” message as a generic PHP problem.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Diagnose the failing request in the right order
1. Capture the URI, path, and suffix
Copy the full line from the Nginx error log. Record the requested URI, the path after Unable to open primary script:, and whether the message ends in No such file or directory or Permission denied. Also note whether the request is a direct PHP file, a directory ending in /, or a URL with PATH_INFO such as /index.php/account.
Do not substitute the path you expected. The path printed by the error is the value PHP-FPM actually attempted to open, so it is the most useful evidence for finding a bad prefix or chroot mismatch.
2. Inspect the location that actually handled the request
Review the complete, expanded Nginx configuration rather than only the file you normally edit:
sudo nginx -T
Find every location that could match the URI, including regular-expression locations, nested locations, and locations loaded from included files. Check the winning block’s root, alias, fastcgi_param, fastcgi_index, and try_files directives.
Rank #2
- Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
- Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
- Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
- Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
- Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth
A second include can change the effective FastCGI parameters. Nginx inherits fastcgi_param directives only when none are defined at the current configuration level; a location-level definition or another include can therefore replace what you thought was active. Search the output of nginx -T for every SCRIPT_FILENAME assignment and for every included parameter file.
3. Calculate SCRIPT_FILENAME yourself
Substitute the actual values into the expression used by the active location. With:
root /var/www/site;
and a request for /index.php, the standard expression resolves to /var/www/site/index.php. If the error log shows a different prefix, Nginx is not using the root you assumed.
Trailing-slash requests need special attention. If the URI ends in /, fastcgi_index index.php; can add index.php to $fastcgi_script_name. A request for /admin/ can therefore resolve to /var/www/site/admin/index.php. Confirm that this file exists and that the index setting matches the application’s layout.
Free tools Windows power users keep installed
One-click scans. No signup required.
Be cautious with alias. An alias replaces the location prefix rather than appending the URI to a directory in the same way as root. A generic $document_root$fastcgi_script_name expression may be wrong for an aliased location, especially in a regular-expression location. Build the path explicitly for that layout and verify it against the actual file.
4. Compare the host filesystem with the FPM worker’s view
Ask whether the exact calculated pathname exists from PHP-FPM’s point of view, not merely from an interactive shell. The pool configuration can set chroot, which changes the worker’s filesystem root at startup, and chdir, which changes its working directory.
Rank #3
- 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
- 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
- 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
- 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
- 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.
For example, suppose the host stores the script at /var/www/site/index.php and the pool has:
chroot = /var/www/site
Inside that jail, the same file is /index.php. Sending /var/www/site/index.php makes the worker look for /var/www/site/var/www/site/index.php inside the jail, so it fails. In a chrooted pool, use the path that exists inside the jail, commonly the chroot-relative $fastcgi_script_name, and make all related paths consistent with the jail.
5. Test access as the pool identity
Find the user and group configured for the relevant FPM pool. Then test the exact path using that account. For example:
namei -l /var/www/site/index.php
sudo -u www-data test -r /var/www/site/index.php && echo readable
Replace www-data and the pathname with the values used by your installation. The worker needs execute (x) permission on every parent directory, not just read permission on the PHP file. A directory such as /var, /var/www, or the application directory can block traversal even when index.php is world-readable. Symlink targets also require traversal and read access.
If ordinary Unix permissions look correct but the suffix is Permission denied, inspect the system’s mandatory access-control policy. AppArmor, SELinux, or an equivalent mechanism can deny the worker independently of mode bits. Check the policy audit log and adjust the policy or file labeling for the intended document root; do not mask the problem by making the entire tree writable.
6. Reject missing scripts before sending them to FPM
Put an existence check in the PHP location:
try_files $uri =404;
This converts a request for a nonexistent script into a normal 404 and prevents PHP-FPM from logging a startup error. Confirm that the check matches your routing model. If you intentionally support PATH_INFO, split the script portion and path-info portion deliberately; an overly broad regular expression can make $uri refer to a route rather than the PHP file.
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 →Rank #4
- 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
- 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
- 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
- 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
- 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.
Use a mapping that matches your deployment
Standard layout without chroot
For a normal shared filesystem, a minimal PHP location is:
location ~ .php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/run/php/php-fpm.sock;
}
The socket pathname is only an example; use the socket configured by your PHP-FPM service. The important part is that the root selected for the request points to the same absolute tree that the FPM workers use. If the application has several roots, define the mapping in the corresponding location instead of assuming one global document root.
Fixed absolute prefix
A fixed prefix can be clearer when one virtual host always maps to one directory:
fastcgi_param SCRIPT_FILENAME /srv/app$fastcgi_script_name;
This is safe only when /srv/app is the real path visible to FPM for every request handled by that location. It becomes wrong after a document-root change, a second application, an alias, or a chroot unless the prefix is changed to the worker’s internal path.
Chrooted pool
With a pool rooted at /var/www/site, the host’s /var/www/site/index.php is /index.php to the worker. A chroot-aware location can therefore use:
location ~ .php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
fastcgi_pass unix:/run/php/php-fpm.sock;
}
Use this pattern only when the pool is actually chrooted and the URI-to-file mapping inside the jail is correct. The socket, log files, temporary directories, session storage, and working-directory paths must also be reachable under the jail’s filesystem rules. A configuration that fixes the script path but leaves logs or temporary storage outside the worker’s view can fail later in a different way.
Best Value
- 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
- 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
- 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
- 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
- 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.
PATH_INFO and front-controller routing
Applications that use URLs such as /index.php/account need an explicit decision about which part is the script and which part is PATH_INFO. A plain location ~ .php$ does not match every such URL, while a permissive pattern can pass the entire URI as a filename. If you enable path-info splitting, verify that the resulting script component exists and that try_files checks that component rather than the complete route. Keep this behavior separate from ordinary direct-file handling so a typo cannot dispatch an arbitrary path to FPM.
Understand how Nginx location details create wrong paths
- Unexpected root: A more specific location can have a different
rootfrom the server block. The PHP request then uses that location’s document root. - Alias mismatch: An
aliasmaps a location prefix directly to a directory. Concatenating$document_rootand the original script name can add the URI prefix twice or point outside the alias. - Regex override: A regular-expression location can win over a prefix location and bring its own FastCGI parameters.
- Duplicate parameter include: One include may define
SCRIPT_FILENAME, while another location-level definition changes the value you expected. - Index expansion: A trailing slash combined with
fastcgi_indexadds a filename that may not exist in that directory. - Chroot prefix: A host-visible absolute path is not automatically valid inside the worker’s jail.
Choose among common layouts
| Layout | Filesystem view | Mapping source | Best fit | Main risk |
|---|---|---|---|---|
| Shared root, no chroot | Nginx and FPM see the same absolute tree. | $document_root$fastcgi_script_name or a matching fixed prefix. |
Single-site or conventional multi-site configurations. | A location override or wrong root sends a valid URI to another tree. |
| Fixed-prefix application | Both processes see one known application directory. | Hard-coded absolute prefix plus the script name. | One stable virtual host with no aliases. | The prefix becomes stale after a deployment or document-root change. |
| Chrooted pool | FPM sees paths relative to its jail; Nginx may still use host paths. | Chroot-relative script path, with jail-consistent ancillary paths. | Deployments that deliberately isolate a pool. | Passing the host prefix causes duplicated directories inside the jail. |
| Alias or PATH_INFO routing | The URI-to-file relationship is customized. | Explicit mapping and intentional script/path-info splitting. | Asset mounts, front controllers, and legacy routes. | Generic root-based formulas can point to the wrong file or accept a route as a filename. |
The safest choice is the simplest mapping that reflects the FPM worker’s actual filesystem view and rejects nonexistent scripts before dispatch. Complexity should be introduced only for a documented alias, chroot, or routing requirement.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Validate the correction without guessing
- Run
sudo nginx -t. Do not reload a configuration that fails syntax validation. - Reload Nginx after changing its configuration, for example with
sudo systemctl reload nginxwhere systemd is used. - Reload or restart the PHP-FPM service or pool after changing pool settings such as
chroot,user, orgroup. Use the service name provided by your distribution. - Request a PHP file that is known to exist. Test the same URI through the real virtual host and, if applicable, HTTPS, because different server blocks can select different roots.
- Request a deliberately nonexistent PHP path. It should return a clean 404 from the
try_filescheck rather than an FPM primary-script error. - Check both Nginx and PHP-FPM logs after the request. The original path error should be gone, and the response should come from the intended application.
Do not declare the fix complete merely because nginx -t succeeds. Syntax validation cannot prove that the worker can see the calculated file or that the pool identity has permission to read it.
Security and operational safeguards
Keep PHP-FPM on a protected Unix socket or a restricted local endpoint. A client that can open a FastCGI connection can influence request configuration, including settings such as auto_prepend_file, and may be able to execute arbitrary code. Do not expose an unrestricted FPM listener to the public network.
Use the narrowest PHP location that your application needs, retain the existence check, and avoid broad writable permissions on the document tree. When permissions or mandatory-access-control rules must change, grant the FPM identity only the traversal and read access required for the application. Record the chosen root, alias, chroot, pool identity, and socket in deployment documentation so a later path change does not silently recreate the error.
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.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problems

