TinyWebDB requests generate HTTP 406

I see many who have indicated they get “Communication with the Web Service encountered a protocol Exception” when using Tiny Web DB from Kodular. I get the same, with my self hosted TinyWebDB-PHP. I even tried two different ones, but they both give the same result. Looking closer at it, the request comes to the PHP program, but generates a HTTP 406 (this i see from the webserver log, which shows the access, and the 406). It does not write to the DB, so apparently the HTTP 406 is decided early by the PHP program.

Moreover, the little test page that comes with the TinyWebDB-PHP allows me to send getvalue and storeavalue requests, and they work as expected.

I am hence beginning to wonder if my TinyWebDB-PHP is not compatible with the current Kodular version, and its Tiny WebDB component? Has there been changes to the (very simple) protocol? ​

I have tried all the various tricks I found that others are suggesting, including:

  • using both http and https

  • adding the “storeavalue” and “getvalue” explicitly to the server URL prior to making the request

  • including or excluding the “/” at the end of the URL

  • putting the code in the root of my public_html to avoid a path that might cause problem

  • making sure there is no doubt the access rights are sufficient

The PHP code itself is trivial, pretty much. But it seems it never gets to execute, or at least does not get far

Anyone has a clue what is wrong?

Have you checked the tinywebdb server before working on it??

Have you tried sending data via a url ? If using GET then you can use your browser, if using POST then use curl or postman to test. Does that work, or do you get the same error?

I have my own tiny WebDB PHP installed, and it works just fine from a test page that comes with the distribution.


I can see from the PHP code thatoit will be rejected if i use GET.

if ($_SERVER[‘REQUEST_METHOD’] != “POST” || !isset($_REQUEST[‘tag’])) {
die(“Not Allowed”);

I can use it from a simple test page that comes with the distribution, which uses POST, and nicely inserts and reads data into the DB as intended. But the requests from my KodularApp fails. They reach the webserver, but they result in no answer that Kodular likes. The answer is a http 406, as i said, and that implies that the request comes with requirements on the format of the response that cannot be fulfilled, as far as I know. But I cannot see that request, so I cannot tell what is wrong

Then you need to show your relevant blocks here, and full text of any urls so that we can assess whether these should work…It may also help to show your storeavalue.php file contents.

There is very little to it. Just two buttons for get and store, and receiving the results and putting it in a label. This is built just to see how (or as it turns out, IF) it works:


The buttons send the requests (that I see in the log of my webserver):

The URL to the server is a simple http:///aaaaaa.se (not aaaaaa though, but six other letters).

The PHP code is this: https://github.com/Kodular/TinyWebDB-PHP, and as you see, it is trivial. The only thing I cannot judge is what the Kodular blocks send exactly, that causes the http 406. And my best guess is that something has changed to the tiny little protocol that Tiny WedDB uses since the code I use was written. But I find no info on any such changes. And it is so simple that I find it hard to see why any changes would be needed…

I also tried this https://github.com/TinyWebDB/tinywebdb-php, with the same result. But there you have a test page, and storing and reading from that works just fine

Worst case I need to start writing debugging code in the PHP-parts to figure out what is going on (which is fine, but a waste of time)

The database file is not touched. But

And some more:

Moving the lot to a directory called /tiny, my log shows this when I try from browser.

The GET’s don’t work from an application perspective (I get a “Not allowed” back, which is generated by the PHP), but the HTTP request succeeds (200). There seems to be no problems reaching the webserver, and the URL for getvalue. But the Kodular block does something different, obviously (apart from posting).

The attempts from the KodularApp looks like this in this:

No browser info, for some reason. Maybe that is a clue to how far the request reaches…?

Try with a web component…

Web1.url : https://aaaaaa/se/storeavalue.php

PostText : tag = A & value = some text

Check your web1.GotText in a label

Let us simplify…

Get on to your server
Create a directory called twbtest, make sure it is accessible from the web
Unzip the files in this zip and upload them to that directory
twbtest.zip (947 Bytes)
Set the file permissions for all the files to 777
In Kodular, create a new project, and drag in the tinywebdb component, a couple of buttons, and a label.
Set up your blocks like so (this is in AppInventor)


If this works (which it should) then you can build from here.

The php files should work with either GET or POST for testing.

Thanks for the suggestion

However, this does not work, for at least two reasons:

  1. The result is still a http 406
  2. The URL gets wrong with that explicit setting of the service URL to include the phpfile:

(I placed them in the root of my public_html, as you can see)

The code and blocks you provide are pretty much the same I already tried, and I suspect the execution never reaches them (or at least never starts executing them, the PHP-engine is probably reached), so the small difference in them makes no difference.

A question: Why would execution rights be needed? These are php files, and never executed (only parsed), so as far as I can tell, read access should be enough, except for the database which of course needs write also.

This, on the other hand, works just fine. Reading and writing to my DB as expected. And it can be used instead, since as far as I can tell it is equivalent. But what does that mean to the Tiny WebDB blocks? Are they not working as they should? Or am I doing something wrong?

Explain what is going on here, it looks wrong:


You can test in your browser:

https://aaaaaa.se/storeavalue.php?tag=A&value=A text

The tinywebDB blocks aren’t doing anything different

It goes wrong because that is what happens when I follow your suggestion to set the service URL to contain the “getvalue.php”. I had tried it already before posting here, as I said in my first post. So this was only to show the log from that kind of case.

My assumption, without knowing, is that the “.get Value” block adds the “getvalue” part to the service URL, and that the service URL therefore should not contain “getvalue”

works from the browser (with your code, which accepts get and put, but not with my original one that requires a POST). It does not work using the kodular.io app with the Tiny WebDB blocks, however.

But, as I showed, using the Web Block works. So the DB itself seems to work, and can be used from the App using WebBlocks, but not using the Tiny WebDB blocks. If you say they do the same thing, I am lost. Why is the result not the same?

And to be 100% clear, this (which is the full code) works just fine, with my original Tiny WebDB PHP; as well as with the one you provided. My original DB requires POST (which I think is a good idea), so it won’t work from the browser, like yours does.


If I try to use the Tiny WebDB blocks instead, I am back to the HTTP 406 errors, with both DB implementations.

As far as I Can tell, I can use the Web blocks to do do this, but I really would have preferred that the Tiny WebDB blocks were understandable to me, and worked. Something beats me…

Are you setting the service url with the php file at the end., and doing this in the blocks before calling the tinywebdb store/get block, like this:

Also, as I said, the php files I sent will work with either GET or POST

And by the way, compare my picture with yours, and you see that i did exactly as you did, and as you asked if I did. If it works for you, it still does not for me. It gives the log entries you call “strange”. With are clearly not what they should be to work. But then again, they still get the 406, so I doubt the content of the file, or it existenxe even, matters.

Whatevwr I put in as service URL gets the “getvalue” concatenated at the end by the Tiny WebDB block. Hence the strange URLs in the figure. But they were there only to show what I had already said in the start: strange the full service URL in a block before the request does not solve it for me.

I do not want GET to work, but only POST, so I prefer using the ones I pointed at initially. But it does not matter, yours don’t work any more than those. The tesult is the same. HTTP 406. And that is not explicirly returned anywhere from the PHP code. It is genwrated elsewhere.

The only thing that works from the Kodular based App is using the Webblock. That goes for the two TinyWebDB variants i refer to, as well as yours.

From the browser you code works, but that does not help. My two variants works in the sense that they return a proper fault massage “not allowed”, which is generated by the PHP script.

From a test page doing POST, the two Tiny WebDB variant i have works. Yours I have not tried, but i have no reason to brlieve it does not.

You are showing the web component blocks in your post, not the tinywebdb blocks…