jignesh
answered Apr 25 '23 00:00
To enable error reporting in nginx php config, you need to modify the php.ini file and the nginx configuration file. Here are the steps to do so:
1.Locate your php.ini file. The location of the file may vary depending on your server setup. Common locations are /etc/php.in i or / usr/local/lib/php.in i.
2.Open th e php.ini file in a text editor.
3.Find the er ror_reporting directive and set it to the level of error reporting you want. For example, to report all errors, you can set it to:
error_reporting = E_ALL
4.Find the display_errors directive and set it to On to display the errors on the screen. You can set it to Off to hide the errors from the screen.
display_errors = On
5.Save and close the php.ini file.
6.Open your nginx configuration file, which is usually located in / etc/nginx/nginx.conf.
7.Find the fastcgi_params section and add the following line to pass the PHP_VALUE settings to PHP:
fastcgi_param PHP_VALUE "error_reporting=E_ALL \n display_errors=On";
8.Save and close the nginx configuration file.
9.Restart your nginx and PHP-FPM services for the changes to take effect.
sudo service nginx restart
sudo service php-fpm restart
Once you have completed these steps, error reporting will be enabled in your nginx php config, and errors will be displayed on the screen with line breaks.