title: PHP backend code running on localhost but not on server
body: <p>I am trying to create backend for a website. I successfully created it. It ran perfectly on the localhost. Now when I moved the code to the server, The php just doesn't work. It shows an empty white screen.</p>
  
  <p>It takes an input and returns a JSON output. What could be the problem ?
  I am using Amazon EC2 server.</p>
  
  <p>Here is my php code : </p>
  
  <pre><code>&lt;?php
  
      require_once('common/common_database.php');
  
      class user
      {
          public $id;
          public $fName;
          public $lName;
          public $sex;
          public $image;
          public $birthday;
          public $location;
  
          public function __construct($userId)
          {
              $this-&gt;id = htmlspecialchars ( $userId );
          }
  
          public function getDetails()
          {
              global $dbh;
  
              //getting user's first and last name
              $query = "SELECT * FROM `user` WHERE `id` = :id;";
              $s = $dbh-&gt;prepare ( $query );
              $s-&gt;bindParam ( ":id" , $this-&gt;id );
              $s-&gt;execute (  );
              $r  =  $s-&gt;fetch (  );
              $this-&gt;fName  = htmlspecialchars( $r['firstName'] );
              $this-&gt;lName = htmlspecialchars ( $r['lastName'] );
              $this-&gt;location = htmlspecialchars (  $r['location'] );
              $this-&gt;image = htmlspecialchars ( $r['image'] );
              $this-&gt;birthday = htmlspecialchars ( $r['birthday'] );
              $this-&gt;sex = htmlspecialchars ( $r['sex'] );
  
          }
      }
  
      if ( isset($_GET['id']) )
      {
          $newUser = new user( $_GET['id'] ); 
          $newUser-&gt;getDetails();
      }
      else
      {
          $newUser = 0;
      }
  
      $output = json_encode ( $newUser );
      header('content-type: application/json');
      echo $output;
      exit;
  ?&gt;
  </code></pre>