What is the correct way to integrate wordpress with another php application?

looks like you’d need to insert your code to the existing WordPress site. please follow this logic:

  1. create a WP install.
  2. create a custom template for your app.
  3. migrate the PHP code and see that it works.

good luck!