-6

See this Screenshot http://prntscr.com/fmcnp7

If my PHP Code have any bug, like missing semicolon, then i get this error. Instead of this, i am supposed to get a error line by PHP right? What's wrong?

  • 1
    Hi and welcome to Stack Overflow, your question is lacking a lot of information that we require in order to be of any help to you, this is also a issue in regards of keeping up with Stack overflows requirements, please visit [the tour](https://stackoverflow.com/tour) in order to get a better understanding of how SO works. – Epodax Jun 21 '17 at 09:59
  • Lacking any detail? Like how? I do not need more details, i guess – Yash John Jun 21 '17 at 10:01
  • I was getting PHP error line yesterday, but idk what happened today. – Yash John Jun 21 '17 at 10:01
  • @YashJohn this is an [internal server error](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500), may be caused for many reasons, you have to share us your code and your server logs to figure out what is the problem – Mohammad Jun 21 '17 at 10:06
  • https://stackoverflow.com/questions/17693391/500-internal-server-error-for-php-file-not-for-html this helped...thanks – Yash John Jun 21 '17 at 10:07
  • Before post other questions here please, go to the [Help Section](http://stackoverflow.com/help) and read [What types of questions should I avoid asking?](http://stackoverflow.com/help/on-topic), then, if you are sure your question fits the SO rules, read [How to Ask a question on StackOverflow](http://stackoverflow.com/help/how-to-ask) to be able to make a good, well formed and on-topic question. – gp_sflover Jun 21 '17 at 10:13

2 Answers2

-1

HTTP ERROR 500 can be spotted as error when you miss something in PHP Code but not semi colon.If you miss semi-colon from PHP, the page won't display anything. The better way is to share your code and then we can take a look on it.

John Mattan
  • 21
  • 1
  • 3
-1

first of all your question is incomplete but that's not your problem.. you are learning we are all human.

You can check where the error is coming from in two different ways.

  1. the first and inconvenient one is opening the logs file which is in your root directory of your website and search for the latest time-stamp and read through where your error is coming from.

  2. The other is is to include these lines of code on top of your index webpage

    ini_set("display_errors",1); ini_set("display_startup_errors",1); error_reporting(E_ALL); ?>

then you are set.

For me i wrap this code inside a class with static method

// errors.php
<?php
class errorReporting{

     public static function displayerrors($switch){

         if($switch == "on"){

             ini_set("display_errors",1);
             ini_set("display_startup_errors",1);
             error_reporting(E_ALL);

          }
        return false;    
      }  
}

?>

//index.php

<?php

    include_once "errors.php";

    errorReporting::displayerror("on");

?>
Leon Tinashe
  • 97
  • 1
  • 9