Re: [PHP] Many Small Files or Larger Utility Files
- Date: Tue, 21 Jun 2016 08:10:22 +0200
- From: Per Jessen <per@xxxxxxxxxxxx>
- Subject: Re: [PHP] Many Small Files or Larger Utility Files
> I have made a number of web sites using PHP and mySQL. These included
> a control panel for adding and maintaining content.
> I am stepping up and creating a site that will require sessions,
> private areas and user registration functions.
> I have looked at samples and note that they all use many small files.
> I see that as being difficult to manage.
> But I have also looked at the code for a PHP bulletin board. Many,
> many small files, so I see that it is a common practise. But I see it
> as complicated and difficult to manage.
> For my control panel code I have all the routines, about 10, to
> process POSTS in one file. It works fine.
> Now activity is low, but that will also be the case with my new site.
> So my question: Is small, single function, files the best practise, or
> I am just fine in combing many functions into larger "library" files.
> Thank you for your thoughts.
I recently investigated a performance problem for a customer. He was
using a CMS written in PHP, perfectly fine, but requests took much too
long to serve. In the end I determined that each request needed to
read some 200 files which took 600ms on a single-user machine, somewhat
longer in the shared, redundant environment.
I would not call "small, single function, files" the best practice, but
how you manage your project is mostly up to you.
Per Jessen, Zürich (15.5°C)
http://www.dns24.ch/ - free dynamic DNS, made in Switzerland.
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php