Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new JWT() - 500 Internal server error #32

Closed
MateusOFCZ opened this issue Oct 28, 2022 · 1 comment
Closed

new JWT() - 500 Internal server error #32

MateusOFCZ opened this issue Oct 28, 2022 · 1 comment

Comments

@MateusOFCZ
Copy link

MateusOFCZ commented Oct 28, 2022

Hello, when I call the route with $jwt = new JWT('secret', 'HS256', 3600, 10); on code, returns Server Error 500, I'm using Docker:

api/test.php:

<?php
  include "../vendor/autoload.php";
	use Ahc\Jwt\JWT;

  $jwt = new JWT('secret', 'HS256', 3600, 10);
?>

Error on POST:
image

In Try Catch return this error:

Error Object
(
    [message:protected] => Class 'Ahc\Jwt\JWT' not found
    [string:Error:private] => 
    [code:protected] => 0
    [file:protected] => /var/www/html/api/test.php
    [line:protected] => 8
    [trace:Error:private] => Array
        (
        )

    [previous:Error:private] => 
)

When I remove $jwt = new JWT('secret', 'HS256', 3600, 10); the error not occurred.
Any idea how solve this?

@adhocore
Copy link
Owner

adhocore commented Oct 28, 2022

oh, it is autoload issue maybe? can you run composer dump-autoload -o once in the terminal from root dir?

also could you change from include to require _once for vendor/autoload.php?

btw, did you add adhocore/jwt in composer.json and run composer install first?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants