Can you give us more details on your hosting and how you installed Flarum? Did you use the "customizing paths" instructions from our documentation or are you using the provided public folder?
If you're seeing the content of a PHP file, you might not have enabled PHP correctly on your hosting.
Once you correctly set the DocRoot to the public folder, or to the root folder after following "customizing paths", you should access /, not /index.php to continue with the installation. Make sure rewrites are working (if apache) so that the request gets handled by index.php automatically.