The issue is figuring out how to present it to the user via a web server. Web languages like php just work with Apache and are more or less designed to run as a web language. For C++ you'd probably have to use cgi-bin which has a performance and security penalty. I think that's considered mostly deprecated now days. Before I learned php I used to write simple "scripts" in C++ and use cgi-bin and it did work. If you call it, it executes the C++ code server side and returns an output. So you can have it generate html code and such just like you would any web based language.
One method that might work better than cgi-bin would be to write the application as a stand alone web server that listens locally only, then use a reverse proxy to point to it and handle SSL. (would be complex to handle that yourself) I could see it being a useful approach for a larger scale application that can benefit from the performance or is distributed across multiple servers. But then I wonder if the reverse proxy setup would also introduce a performance hit, negating the benefits of C++, vs just using php directly without a reverse proxy. Although I'm just speculating here, I'm not sure what the hit is with using a reverse proxy, I suspect it's not very high with something like Ngynx which is optimized for it.