Newbie questions for the PHP5 experts in this ng



Hi All,

I have just recently (~ 3wks) playing around with PHP. I come from an OOP background (mostly C++) so I have taken to PHP5 like a duck to water. However, I have a number of nagging questions that I have not yet manage to resolve (all the websites I have visited seem to assume I already know the answers - or could it be that PHP is so loosely held together that it lets one get away without a proper architecture for an application (is "application" the correct term for a bunch of PHP scripts running server side or is there another term?)

Question 1:
===========
Is there any such thing as a PHP application (or are PHP solutions just a bunch of "loosely coupled" scripts thrown together)?



Question 2:
=============
Assuming there IS such a thing as a PHP application, how does one go about putting one together?. In the C++ world, there is the concept of libraries, in Java there are packages, In .Net there are assemblies.


i). How do PHP solutions logically partition functionality?.

Writing extensions in C seems to be one way to go, but apart from that being overkill, I my ISP may not even allow me to load my extension. There must be a simpler way to partition logic surely ?.


Question 3:
==============
I have seen a few examples that seem to partition functionality by splitting objects into various files (a bit like the use of header files in C/C++), along with a liberal showering of calls to include() in the code - however, unlike header files, the files "included" contain not just the class definitions etc, but also (more critically), the implementation (i.e. any business logic that may show how your system may be compromised).


i). Is it possible to have your "header" files (i.e. class implementation source code) stored in a directory location that is hidden in some way - the main goal is to thwart any hacker who may simply look at your include() method calls, casually navigate to the appropriate directories and peruse your source code at his/her leisure.

ii). There are potential issues about using include().
a). I remember reading somewhere that you have a performance hit (I/O bottleneck) every time you call include
b). There are potential security issues - You can't use include() if you use a function called something like basedir() (or something - sorry, I don't remember the function name). But this function allows one to restrict users from accessing files above the parent of a specified directory. Any (informed) feedback on this will be much appreciated.


I would be very pleased to get informed feedback on this last question (Q3) in particular because the thought of having code that shows a hacker how authentication or licensing (for example) is implemented at the server side does not bear thinking about. I look forward to hearing from the PHP5 gurus in this ng.

Many Thanks

.



Relevant Pages

  • Re: [PHP] Are PHP5 features worth it?
    ... I'm writing a PHP program and I've got a number of concerns. ... what PHP4 can do with OOP. ... using what PHP5 offers where it makes sense, ... Exceptions: I just don't see the big advantage. ...
    (php.general)
  • Re: Php5 port and Apache Module
    ... possible to install php5 from the packages .. ... in any way of justifying removing the apache module from the default setting ... people installing php do so for use as an apache module. ...
    (freebsd-questions)
  • Re: [PHP] PHP4 vs PHP5 Performance?
    ... I already have an XML API that works fine in PHP4. ... There's only a narrow sliver of use cases where I'd say PHP 4's primitive SAX ... but that's a compatibility / performance tradeoff. ... Otherwise default to PHP5 C implementations. ...
    (php.general)
  • Re: PHP4 to PHP5
    ... I'd like to upgrade this so I can use the PHP5 code I have already. ... What kind, if any, problems will I have with the existing PHP code base? ... I think PHP suffers from the same problem that ASP does. ... VB, DCL, sh, csh, etc. and there isn't a language that I have seen that can prevent "any idiot to write the most horrible unmaintainable crap". ...
    (comp.lang.php)
  • Re: [PHP] PHP5 & Commercial Development
    ... I seem to be smelling the red herring technique of changing ... I haven't tracked this particular issue, but I know when PHP5 was first released is wasn't recommended in a commercial/production environment. ... Since I am unaware of what version of PHP Yahoo mainly uses (I've heard some of their developers talk, and they use PHP 5) and since Google seems to be a Java shop, I took the liberty of giving my oiwn view of why PHP should be used for professional development. ...
    (php.general)