title: Getting 404 Page Not Found when accessing my index.php file
body: <p>I have been working on an Android App, now I want to have a database on the server from where my App will fetch the data.</p>
  
  <p>I found making a REST API with PHP to access a MySQL database is the easiest solution, but am totally alien to php (touching it for the first time).</p>
  
  <p>I am getting "404 Page not found" when I try to hit -- <a href="http://localhost/oneview_alerts/v1/notifications" rel="nofollow noreferrer">http://localhost/oneview_alerts/v1/notifications</a></p>
  
  <p>My WAMP server is up and running.</p>
  
  <p>My code is very small and simple, and I referred below URLs to take help:
  1) <a href="https://www.androidhive.info/2014/01/how-to-create-rest-api-for-android-app-using-php-slim-and-mysql-day-12-2/" rel="nofollow noreferrer">https://www.androidhive.info/2014/01/how-to-create-rest-api-for-android-app-using-php-slim-and-mysql-day-12-2/</a></p>
  
  <p>2) <a href="https://www.androidhive.info/2014/01/how-to-create-rest-api-for-android-app-using-php-slim-and-mysql-day-23/" rel="nofollow noreferrer">https://www.androidhive.info/2014/01/how-to-create-rest-api-for-android-app-using-php-slim-and-mysql-day-23/</a></p>
  
  <p>I am absolutely new to PHP and not able to understand where to start debugging. Its not like my Java or Python where I could straight away see the error logs in logcat or debugger. Or may be there is a way, I am just not aware of it.</p>
  
  <p>Please help!!</p>
  
  <p>In my access.log file am getting 
  "127.0.0.1 - - [26/Dec/2018:19:15:59 +0000] "GET /oneview_alerts/v1/notifications HTTP/1.1" 404 532"</p>
  
  <p><b>index.php</b></p>
  
  <pre><code>&lt;?php
  /**
   * Created by PhpStorm.
   * User: JM00490784
   * Date: 12/26/2018
   * Time: 6:05 PM
   */
  
  ini_set('display_errors', 'On');
  error_reporting(E_ALL);
  
  require_once '../include/DbHandler.php';
  require '.././libs/Slim/Slim.php';
  
  \Slim\Slim::registerAutoloader();
  
  $app = new \Slim\Slim();
  
  function echoResponse($status_code, $response) {
      $app = \Slim\Slim::getInstance();
      // Http response code
      $app-&gt;status($status_code);
  
      // setting response content type to json
      $app-&gt;contentType('application/json');
  
      echo json_encode($response);
  }
  
  $app-&gt;run();
  
  $app-&gt;get('/notifications', function() {
  
      $response = array();
      $db = new DbHandler();
  
      // fetching all user tasks
      $result = $db-&gt;getAllNotifications();
  
      $response["error"] = false;
      $response["notifications"] = array();
  
      // looping through result and preparing tasks array
      while ($notification = $result-&gt;fetch_assoc()) {
          $tmp = array();
          $tmp["id"] = $notification["id"];
          $tmp["notification_text"] = $notification["notification_text"];
          $tmp["hostname"] = $notification["hostname"];
          $tmp["service"] = $notification["service"];
          $tmp["value"] = $notification["value"];
          $tmp["timestamp"] = $notification["timestamp"];
          array_push($response["notifications"], $tmp);
      }
  
      echoResponse(200, $response);
  });
  
  ?&gt;
  </code></pre>
  
  <p><b>DBHandler.php</b></p>
  
  <pre><code>&lt;?php
  
  /**
   * Class to handle db operations
   * This class will have CRUD methods for database tables
   *
   * @author Jotinder Singh Matta
   */
  class DbHandler {
  
      private $conn;
  
      function __construct() {
          require_once dirname(__FILE__) . './DbConnect.php';
          // opening db connection
          $db = new DbConnect();
          $this-&gt;conn = $db-&gt;connect();
      }
  
      public function getAllNotifications() {
          $stmt = $this-&gt;conn-&gt;prepare("SELECT * FROM notification ORDER BY timestamp DESC");
          $stmt-&gt;execute();
          $notifications = $stmt-&gt;get_result();
          $stmt-&gt;close();
          return $notifications;
      }
  
  
  }
  
  ?&gt;
  </code></pre>
  
  <p><b>DBConnect.php</b></p>
  
  <pre><code>&lt;?php
  
  /**
   * Handling database connection
   *
   * @author Jotinder Singh Matta
   */
  class DbConnect {
  
      private $conn;
  
      function __construct() {
      }
  
      /**
       * Establishing database connection
       * @return database connection handler
       */
      function connect() {
          include_once dirname(__FILE__) . './Config.php';
  
          // Connecting to mysql database
          $this-&gt;conn = new mysqli(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_NAME);
  
          // Check for database connection error
          if (mysqli_connect_errno()) {
              echo "Failed to connect to MySQL: " . mysqli_connect_error();
          }
  
          // returing connection resource
          return $this-&gt;conn;
      }
  
  }
  
  ?&gt;
  </code></pre>
  
  <p><b>Config.php</b></p>
  
  <pre><code>&lt;?php
  /**
   * Database configuration
   */
  define('DB_USERNAME', 'root');
  define('DB_PASSWORD', '');
  define('DB_HOST', 'localhost');
  define('DB_NAME', 'oneview_alerts');
  
  ?&gt;
  </code></pre>
  
  <p><b>.htaccess</b></p>
  
  <pre><code>RewriteEngine On 
  RewriteCond %{REQUEST_FILENAME} !-f 
  RewriteRule ^(.*)$ %{ENV:BASE}index.php [QSA,L] 
  </code></pre>
  
  <p><b>desc notificatiion table</b></p>
  
  <pre><code>desc notification
  
  
  
  id  int(11) NO  PRI 
      NULL
      auto_increment  
  notification_text   varchar(250)    YES     
      NULL
  
  hostname    varchar(255)    NO      
      NULL
  
  service varchar(255)    NO      
      NULL
  
  value   varchar(255)    NO      
      NULL
  
  timestamp   timestamp   YES     CURRENT_TIMESTAMP       
  </code></pre>