Using a single PHP script for an entire site?

There are many forums that do this. Personally, I don't like it, mainly because if you make an error in the file, the entire site is broken until you fix it I like separation of each part, but I guess it has its plusses It's likely bad for maintenance, as you can't easily disable a section of your site for an update Speed: I'm not sure to be honest Security: You could accomplish the exact same security settings but just adding a security check to a file and then including that file in all your pages.

There are many forums that do this. Personally, I don't like it, mainly because if you make an error in the file, the entire site is broken until you fix it. I like separation of each part, but I guess it has its plusses.It's likely bad for maintenance, as you can't easily disable a section of your site for an update.

Speed: I'm not sure to be honest. Security: You could accomplish the exact same security settings but just adding a security check to a file and then including that file in all your pages.

It's just going to make maintenance more difficult. If you're having a hard time managing multiple files, you should invest the time into finding a better text editor / IDE and stop using Notepad or whatever is making it so difficult in the first place!

Totally correct. Don't do this. There is a reason everyone & every framework separates things.

If you do you're walking into a shit storm of broken, unreadable code. – Tom Schlick May 2 '10 at 4:25.

Many PHP frameworks rely on the Front Controller design: a single small PHP script serves as the landing point for all requests. Based on request arguments, the front controller invokes code in other PHP scripts. But storing all code for your site in a single file is not practical, as other people have commented.

This concept seems very similar to what I mentioned (so it has been done before then ;)), aside from the seperating into seperate files. It does seem that the disadvantages of this method outweigh the advantages though. – james-briggs May 1 '10 at 23:50 A single script would get way too large and take too long to laod.

The Front Controller is designed to have a single point of entry, which is really what you want to do. Then you delegate control to other files, which allows things to scale. – Brent Baisley May 2 '10 at 0:35.

If you're not caching your scripts, everything in a single file means less disk I/O, and since generally, disk I/O is an expensive operation, this probably can be a significant benefit. The thing is, by the time you're getting enough traffic for this to matter, you're probably better off going with caching anyway. I suppose it might make some limited sense, though, in special cases where you're stuck on a shared hosting environment where bandwidth isn't an issue.

Maintenance and security: composing software out of small integral pieces of code a programmer can fit inside their head (and a computer can manage neatly in memory) is almost always a better idea than a huge ol' file. Though if you wanted to make it hell for other devs to tinker with your code, the huge ol' file might serve well enough as part of an obfuscation scheme. ;) If for some reason you were using the single-file approach to try and squeeze out extra disk I/O, then what you'd want to do is create a build process, where you did your actual development work in a series of broken-out discrete files, and issued make or ant like command to generate your single file.

Personally, I don't like it, mainly because if you make an error in the file, the entire site is broken until you fix it. I like separation of each part, but I guess it has its plusses. It's likely bad for maintenance, as you can't easily disable a section of your site for an update.

Speed: I'm not sure to be honest. Security: You could accomplish the exact same security settings but just adding a security check to a file and then including that file in all your pages.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions