@DonManfred:
I'm sorry, the last listing posted was not the one I changed according your suggestion. During all those test, I got mixed up what to post.
The outcome of the test with your suggestion is in my Post#8.
And THANK YOU for the help given so far.
When it comes to MySQL I'm a beginner, I'm sorry for that.
As I see it no connection is made or even tried (no entry in errorlog). When connection to the database from the device on which the database is everything works fine.
In my understanding (which could be wrong) the connection using this php-script would also be done locally. Is that correct?