PHP file won’t work in wordpress folder, but works in another virtual host

Yes. The default WordPress .htaccess file. Without edits, all calls are redirected to index.php.

Your best bet is to pass the call through WordPress as a custom plugin. This answer deals with setting up a REST endpoint. Of course, that means returning JSON which might not be exactly what you are looking for.

Another approach might be to edit the .htaccess file.

Something like this, near the top:

RewriteRule my-qr-code.php$ - [L]

This tells the server that in this case, if the file matches, we are done. That solution comes from a StackOverflow question.