index.php blank page NGINX please tell me step by step how to solve it
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hello, @Thinklatest
Have you checked our tutorials on How To Install Linux, Nginx, MySQL, PHP (LEMP) stack On CentOS server? Please find the links to the articles bellow
If you haven’t checked those tutorials then make sure to check them out because they cover the whole process pretty well.
If you’ve already completed the tutorial on your CentOS droplet then check if the Nginx and the PHP-FPM services are running and double-check the virtual host of your domain name (or the main block if you try to access the index.php page using the droplet IP address).
Hope that this helps! Regards, Alex
Heya,
When you encounter a blank page while trying to access a PHP file such as index.php on a server running Nginx, it typically indicates an issue with PHP processing. This could be due to a number of reasons including Nginx configuration errors, PHP-FPM service issues, or problems with the PHP code itself. Here are steps to diagnose and fix the problem:
systemctl status php-fpm or the equivalent command for your PHP version like php7.4-fpm.
- If it’s not running, start it with systemctl start php-fpm.location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; # Ensure this matches your PHP-FPM socket path
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
fastcgi_pass directive points to the correct socket file for your PHP-FPM version.
systemctl reload nginx.php -l /path/to/index.php from the command line to lint the PHP file.index.php to include the following at the top of the file:ini_set('display_errors', 1);
error_reporting(E_ALL);
index.php file and its directory have the correct permissions and are owned by the user that PHP-FPM runs as (usually www-data or similar).user and group in your PHP-FPM pool configuration file match the user and group that own the PHP files./var/log/nginx/error.log) and the PHP-FPM error log (location depends on your configuration, often /var/log/php7.4-fpm.log) for any indications of what might be wrong.By going through these troubleshooting steps, you should be able to pinpoint why index.php is showing up as a blank page on your Nginx server.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.