I was wondering if it is possible to run a php file in the public folder?
if you put a php-capable server in front of meteor and register that directory in your web server configuration as a document root, yes you can.
But beware, /public
gets translated as /
when you do meteor run
and as /programs/web.browser/app
when you do meteor build
The real problem is that I do not know how to do that like which web server is it running on and all that. I am using digital ocean droplets and MUP to t deploy the app.
That’s not sufficient for running php. You need to also have a php capable server like nginx or apache installed so that you can use that server’s configuration options to selectively run php and meteor (node) from the same codebase.
I’d still say it would be wise to keep php and meteor as separate apps, perhaps running behind a proxy.
DO has great tutorials for installing everything on your machine that you need, just google something like “digital ocean tutorial PHP nginx”. So yes, it’s very doable. I wouldn’t put the PHP files in the public/
folder though, but rather keep them in private/
so noone can just request and download your code if your web server config isn’t 100% safe for that case with PHP in public/
.
If you need more pointers along the way let me / us know.
Also, what’s your use case, i.e. why do you want to run PHP as well as part of your Meteor app? Just so we understand better what problem you’re trying to solve. (I actually have thought about using PHP for some parts as well, like when there’s a bunch of legacy code that still does useful things and would be easiest to deploy just as part of the app…)
Let me do the Ngix tutorial on digital ocean. Otherwise I will have to write a package=more time on the project.
This post may also be worth following.