简体   繁体   中英

Getting HTTP error 500 with Slim Framework (php)

I am getting HTTP error 500 when using the Slim framework.

I have the index.php of Slim Framework in /api/v1/:

<?php

require '../../vendor/autoload.php';

$app = new Slim\App();

$app->get('/auth2', function ($request, $response, $args) {
    $response->write("Welcome to Slim!");
    return $response;
});

$app->run();

In the same folder I have my .htaccess:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]

But when I go to /api/v1/auth2 the page doesn't load. I only get a HTTP error 500. Have I misconfigured Slim?

Put this code at the top of the page you are trying to load.

error_reporting(-1);
ini_set('display_errors', 1);

This will print you the errors if your functions are not with @ .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM