Path: csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Arno Welzel Newsgroups: comp.lang.php Subject: Re: PHP boilerplate to appear at the top of any program Date: Wed, 30 Dec 2015 11:18:36 +0100 Lines: 67 Message-ID: <5683AF7C.9070703@arnowelzel.de> References: <2838299.zdqeYZrqYU@PointedEars.de> <1473248.ziGLShfuNh@PointedEars.de> <5131195.4d26jNU0Ms@PointedEars.de> <1535700.EMr0ZOzjxF@PointedEars.de> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Trace: individual.net Lexj3hVUvY9T4/nyWXr1mQ2uVZOiwXV/FIGDuS4+Xl02sIQqjT Cancel-Lock: sha1:zajW7vgqQ8KIuWuWf9PUmLZ+fFI= In-Reply-To: Xref: csiph.com comp.lang.php:16008 Jerry Stuckle schrieb am 2015-12-28 um 18:29: > On 12/28/2015 12:14 PM, Gregor Kofler wrote: [...] >> Since this is the approach of quite a few (if not most) major web >> application frameworks out there - everyone using such one relies on >> "crappy programming"? >> > > Yes, and most of those frameworks store code in a database - ones such > as Joomla, WordPress, Drupal... But if you're so knowledgeable about > those frameworks, you should understand it. You seem not know anything about the mentioned frameworks. None of these frameworks store code in the database. Maybe you mix up crappy third party extensions for those systems with the respective core system itself. >> Since you consider it "crappy programming" - can you explain *why*? >> >> Gregor >> > > First of all, it's additional overhead on the server. It has to > retrieve the index.php, do some processing, then include the appropriate > scripts to perform the work. As opposed to individual scripts, which > can be retrieved directly via their uri. Additionally, the index.php > file often includes virtually any class files or other includes other > scripts may require. Bytecode caches like XCache or OPcache exist. Having central controllers taking care of things like session handling, authentication, database access etc. makes things easier and less prone to errors due to some "forgotten" scripts somewhere. > The result is higher resource requirements on the server, resulting in > higher workload for the server and slower response time to the client. > Of course, this might not be important to you if you're only serving 10 > pages per hour. But if you're trying to serve hundreds of pages per > second, it's a huge difference. If you want to serve hundrets of pages per second you won't use plain PHP anyway but put everything behind a cache or pre-compile your scripts. On my personal websites I serve about 2-3 requests per second in average for the domains on my server which are used to serve public content (and there are more for other services as well). And so far none of them seem to be very slow due to the "crappy programming" of WordPress or DokuWiki (which both use a central index.php to handle most but not all requests): (using WordPress) (using DokuWiki) (using WordPress) And the server is a quite average machine - about 6 years old (AMD Opteron CPU, 4 GB RAM, 500 GB HDD) and is far from getting overloaded: -- Arno Welzel http://arnowelzel.de http://de-rec-fahrrad.de http://fahrradzukunft.de