How to Solve proxy_fcgi:error AH01071 on cPanel / Apache
After changing the document root for a domain on a cPanel server running Apache and PHP-FPM, the site starts returning "No input file specified." and Apache logs fill up with:
[proxy_fcgi:error] [pid 12345] AH01071: Got error 'Unable to open primary script:
/home/USERNAME/public_html/NEWROOT/index.php'
Restarting Apache, restarting PHP-FPM, clearing caches, and adjusting file permissions do not fix it. The root cause is that PHP-FPM has its own doc_root configuration that does not automatically update when the cPanel document root changes.
The Fix
You need to tell PHP-FPM the new document root explicitly through its YAML configuration, then rebuild and restart the relevant services.
Step 1: Edit the PHP-FPM YAML file
Navigate to the user data directory:
cd /var/cpanel/userdata/USERNAME
Open yourdomain.com.php-fpm.yaml and add the following under the existing configuration:
php_admin_value_doc_root:
name: 'php_admin_value[doc_root]'
value: /home/USERNAME/public_html/NEWROOT
Replace USERNAME with the cPanel account username and NEWROOT with the actual subdirectory path you set as the document root.
Step 2: Rebuild the PHP-FPM configuration and restart
/scripts/php_fpm_config --rebuild
/scripts/restartsrv_apache_php_fpm
/scripts/restartsrv_httpd
Step 3: Update the virtual host configuration files
In the same /var/cpanel/userdata/USERNAME/ directory, open both yourdomain.com and yourdomain.com_SSL and update the documentroot field to match the new path.
Step 4: Rebuild Apache configuration and restart
/scripts/rebuildhttpdconf
/scripts/restartsrv_httpd
Why This Happens
When PHP-FPM is configured through cPanel, it maintains its own pool configuration generated from the YAML files in /var/cpanel/userdata/. The php_admin_value[doc_root] directive in the PHP-FPM pool config tells PHP where the root of the web application is. Changing the document root in WHM or cPanel updates Apache's virtual host configuration but does not automatically regenerate the PHP-FPM pool config — so PHP-FPM is still looking in the old location.
Verification
After completing the steps above, check that the PHP-FPM pool config reflects the new path:
grep -r "doc_root" /etc/php-fpm.d/yourdomain.com.conf
The output should show the updated document root path. Reload the site in a browser — the "No input file specified." error should be gone.
Conclusion
The proxy_fcgi:error AH01071 error after a document root change is caused by a mismatch between Apache's virtual host config and the PHP-FPM pool's doc_root. The fix requires updating the PHP-FPM YAML configuration, rebuilding both the PHP-FPM and Apache configs, and restarting the relevant services. Standard Apache and PHP-FPM restarts alone will not resolve it.