Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
500 Internal Server, Unexpected token s in JSON at position 0 #158
I think this has something to do with the JSON.parse (
However, I don't know how to fix it... I'd really love to use php-crud-api. Therefore I attached a screenshot of my MySql-Database structure.
I'd appreciate your help!
Could the error be caused because of permission issues? (file rights, permissions, .htaccess or stuff like this?).
api.php > 644
This is my api.php at the bottom (values changed of course):
Thx for your fast answer, let me know if there's something else I could provide you.
I would put the collation at 'utf8mb4_general_ci'. Also you should have a primary key defined. Is 'id' a primary key?
The output is as expected and you should comment that line again. Your environment seems normal.
Not very likely
When you have a 500 (Internal Server) error, then there is a line logged in your "error.log". You may find that file at
Here the error.log:
At this point I'm really exhausted right now... I played with every value, even setup various VPS multiple times to check that nothing is wrong with them... But still getting the same error...
I can't imagine what the problem is.
apache2 error.log from the latest try (no errors):
and console.log from client.html:
@Taremeh Please don't give up. I know it is frustrating, but together we can figure this out.
As long as the script keeps outputing warning and errors the JSON will not be valid.
As you can see I updated the code for you. Please try the latest version, it should be compatible with older mysqlnd drivers that do not support 'MYSQLI_OPT_INT_AND_FLOAT_NATIVE' properly.
NB: It does mean that you will have integers as strings in your JSON (due to the old driver).
@mevdschee Thank you so much!
I used Ubuntu 14.04 with PHP 5.5.9, not too old but I'll rethink whether I should use Ubuntu 16 and PHP 7 instead
I really love your work and appreciate the support, keep it going!