Cayenne
Cayenne

Reputation: 25

php slim duplicate response body data

I created a PHP API using Slim framework. The issue is when I moved the API to a new server I started getting issue with the response. The data in the response body is getting duplicated!

For example instead of getting this once in the response:

{data: [{ username: 'someone', password: 'something' }] }


I'm getting this:

{data: [{ username: 'someone', password: 'something' }] }
{data: [{ username: 'someone', password: 'something' }] }
{data: [{ username: 'someone', password: 'something' }] }

It's happening on every response to any route.
Even the page not found it display twice.
here's whats in my .htaccess:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]

Upvotes: 0

Views: 500

Answers (1)

Cayenne
Cayenne

Reputation: 25

Turned out I had my index.php file added inside my routes folder as well by mistake.
This might as well occur if you had multiple $app->run();

Slim Framework Rest service getting output twice

Upvotes: 0

Related Questions