REST API always return error 500 Internal Server Error
Moderators: Developer, Contributor
REST API always return error 500 Internal Server Error
Hi,
Since yesterday afternoon, I have the REST API which always gives me a 500 error with the reason: "Internal Server Error" to each of my requests.
When I started using it it worked perfectly, then the next day when I wanted to create a user I had the 500 error but the user was still create, and now no queries are working anymore,
Could you help me please ?
Since yesterday afternoon, I have the REST API which always gives me a 500 error with the reason: "Internal Server Error" to each of my requests.
When I started using it it worked perfectly, then the next day when I wanted to create a user I had the 500 error but the user was still create, and now no queries are working anymore,
Could you help me please ?
Re: REST API always return error 500 Internal Server Error
oh you're right, I got this error in the PHP logs :
PHP Fatal error: Uncaught RuntimeException: Unexpected data in output buffer. Maybe you have characters before an opening <?php tag? in /opt/bitnami/apps/mantis/htdocs/vendor/slim/slim/Slim/App.php:621\nStack trace:\n#0 /opt/bitnami/apps/mantis/htdocs/vendor/slim/slim/Slim/App.php(317): Slim\\App>finalize(Object(Slim\\Http\\Response))\n#1/opt/bitnami/apps/mantis/htdocs/api/rest/index.php(107): Slim\\App->run()\n#2 {main}\n thrown in /opt/bitnami/apps/mantis/htdocs/vendor/slim/slim/Slim/App.php on line 621
Re: REST API always return error 500 Internal Server Error
Did you change any configuration file (e.g. config_inc,php) yesterday?
Re: REST API always return error 500 Internal Server Error
yes, i tried to comment some parameters and run without those parameters but the result was the same
edit because the image does not load : https://prnt.sc/xd7w67
edit because the image does not load : https://prnt.sc/xd7w67
Re: REST API always return error 500 Internal Server Error
Your editor might have changed the encoding of the file when storing it.
It might now be UTF-8 with BOM, but it should be UTF-8 without BOM.
It might now be UTF-8 with BOM, but it should be UTF-8 without BOM.
Re: REST API always return error 500 Internal Server Error
when I do the "file config_inc.php" command, there is written that the file is in "ASCII text" : https://prnt.sc/xdgk8q
I tried to open the file with vim, and to make the command: ":set nobomb" but that didn't change anything
I tried to open the file with vim, and to make the command: ":set nobomb" but that didn't change anything
Re: REST API always return error 500 Internal Server Error
This is what I get
Double check that there is not any character in this file (and maybe other files you changed) before
e.g. run
Code: Select all
file config_inc.php
config_inc.php: PHP script, ASCII text
Code: Select all
<?php
Code: Select all
od -c config_inc.php
Re: REST API always return error 500 Internal Server Error
I found in one of the files I modified, I had a space before the <?php, I hadn't thought of looking in the other files.
Really thanks for your help
Really thanks for your help
Re: REST API always return error 500 Internal Server Error
Glad to hear you fixed your problem.
We check config_inc.php during runtime, so I would have expected you get also an issue in UI, but not just REST API.
Which file was it?
We check config_inc.php during runtime, so I would have expected you get also an issue in UI, but not just REST API.
Re: REST API always return error 500 Internal Server Error
it was "layout_api.php", when I changed the footer, but yes weirdly, I had no problem in the UI, only with API
Re: REST API always return error 500 Internal Server Error
It's not recommended to change any of the original files. Your problem is a good example for this rule.
Be also aware that you have to reapply those changes whenever you install a new Mantis version.
All configuration should be done by using the configuration options or by writing a plugin.