3 ms·
It has nothing to do with variable names. People aren't rushing to make mod_* for other languages because it implies a lot of behavior (by nature of it being s
by kbenson 14y ago
It has nothing to do with variable names.
People aren't rushing to make mod_* for other languages because it implies a lot of behavior (by nature of it being served through Apache) which isn't really the best idea for security.
Having a structure that mixes the code files, templates (let's ignore mixing of logic and presentation), and static content all in the same publicly accessible location is just asking for security problems.
You can lock down what's accessible or not based on file extensions, but that's through a config that's not part of the deployment (Apache conf) so it's not as easily controlled in your code, or if it is part of the deployment (htaccess), can be affected or overridden by directives nowhere near your code (Apache conf). It's fun when someone breaks the php loading directives in the Apache config and your code starts showing as plain text. You made sure not to hard-code ANY credentials in your PHP files that are publicly reachable, right? Your config isn't publicly reachable, is it?
The closest you are going to get to something sane here is to approximate what the other frameworks are doing, which is to create a completely different site root, and a directory structure that completely separates your public content from your code, and point Apache at the public dir, not the code root. Unfortunately this does nothing to mitigate the problem of someone breaking any URL rewriting you need going on at the global Apache config, nor does it make it any easier to deal with crazy rewriting rules in Apache.
Apache is great at serving content; Apache isn't the best choice anymore for serving applications.
- cadalac 14y ago>Apache is great at serving content; Apache isn't the best choice anymore for serving applications. What is?
- kbenson 14y agoTo clarify, it's not the best choice for serving applications where Apache works as anything but a proxy. For what's best, take your pick of any framework that entirely decouples the application directory structure from the routes and keeps the logic for it all completely internalized. All logic for how URI's are handled should be within the application configuration or code. Something written in the target language will probably provide far more benefits than whatever is lost through Apache. Whether Apache is in the path to your application is irrelevant, whether Apache does anything except note that a request should be handled by another application and hand the entire request off without change is not.
- cadalac 14y agoOh I see. I'm a beginner programmer and I just started learning PHP with Apache yesterday. I was up until 3AM installing and configuring it all along with MySQL and MyPHPAdmin last night. I thought by your post that I should be learning something else instead ;-).
- kbenson 14y agoIn some respects, Apache + mod_php is actually harder to get set up and working that some of the other frameworks, assuming it's not already configured for your box (many linux distros include packages so "it just works").
- vec 14y agoGenerally the application itself. Listening on an http port or a unix socket is pretty easy in most modern languages. Then use a normal HTTP server like apache to listen to incoming connections and proxy them on to whatever port on localhost your application is listening to.