Home > Software design >  I am using a localhost server and visual studio to learn PHP but can't get errors to show up on
I am using a localhost server and visual studio to learn PHP but can't get errors to show up on

Time:01-28

I am learning PHP using VS and am using apache server. When there is an error that I know is an error, my browser just shows a blank screen instead of describing the error. How can I set it to do so? Thanks

I have tried searching 'error' in settings and ensuring all of the error settings seem correct.

CodePudding user response:

Look for your PHP installation folder should be something like this: /bin/php/php-8.1.13-Win32-vs16-x64 When you find it, look for: php.ini and look for this text (and set it to On):

display_errors = On
error_reporting = E_ALL

then save the file and restart the server.

If you don't find this file or do not want to edit it, try to add this at the top of your PHP file:

<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

//Start your php code here

This should be enough in order to display all errors.

  • Related