Re: Re: Best Practices Book, Document, Web Site?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Other than coding standards, the other good read is:
(it seems to cover most topics I have ran into while maintaining a
high traffic site implemented in php 5):

http://phplens.com/lens/php-book/optimizing-debugging-php.php

It is 'best practices' from another angle - use of opcode cache (apc
etc..), output buffering and so on.

Coding standards vary a lot, so I would recommend sticking to one
style once a consensus is reached among the team and preferably
enforce it in automated fashion (e.g.
http://pear.php.net/package/PHP_CodeSniffer/ as a svn pre-commit
hook).

The other easily over-looked part I have seen in many php projects is
the code layout and directory structure, including dependency
management (library code vs business logic etc..), and more
importantly only exposing the main 'entry point' scripts (index.php or
controller.php in a MVC model) in a apache doc root. Many times I have
seen poorly laid out code that ends up getting deployed with the
entire code bases exposed in a apache doc root. If care is not taken
(e.g. naming some files .inc and no special apache rules to interpret
them as a php handler), it is a security nightmare with critical files
getting exposed.

I have my own layout suggestion which has worked well for us, and once
mastered, it makes everyone in the team very productive. Maybe this
can be a separate topic in its own right.

Ravi





On Tue, Mar 2, 2010 at 9:51 AM, Hansen, Mike <Mike.Hansen@xxxxxxxxx> wrote:
>
>
>> -----Original Message-----
>> From: Bob McConnell [mailto:rvm@xxxxxxxxx]
>> Sent: Tuesday, March 02, 2010 7:52 AM
>> To: pan; php-general@xxxxxxxxxxxxx
>> Subject: RE:  Re: Best Practices Book, Document, Web Site?
>>
>> From: pan
>> > ""Hansen, Mike"" <Mike.Hansen@xxxxxxxxx> wrote in message
>> >>
>> news:7941B2693F32294AAF16C26B679A258D0EFDC318@xxxxxxxxxxxxxxxx
>> el.com...
>> >> Is there a PHP Best Practices Book, Document, or web site that has
>> >> information similar to Perl Best Practices but for PHP?
>> >
>> > Yeah, it's hard to find this stuff.
>> >
>> > A google search on {+"Best Practices" +"PHP"} returned only
>> > 4,340,000 hits.
>> >
>> > Maybe, some day, someone will think to write something up.
>>
>> The problem with this method is that scanning these results reveals
>> conflicting and contradictory recommendations that are all over the
>> place. Some are so old they may not even be valid PHP any
>> more. Reading
>> even a small subset of these pages is an exercise in frustration. But
>> that makes sense as there doesn't appear to be any consistency nor
>> consensus within the community, or even within some of the larger
>> projects.
>>
>> Speaking of consensus, based on a recent discussion on the Perl
>> Beginners mailing list, the Perl Best Practices book is now considered
>> to be deprecated among the active Perl community. Many of its
>> recommendations are obsolete and no longer used. It is long
>> past due for
>> a major rewrite.
>>
>> Bob McConnell
>
> Yep. Perl Best Practices is due for a rewrite/update. I came across this page that attempts to update it:
> http://www.perlfoundation.org/perl5/index.cgi?pbp_module_recommendation_commentary
>
> For PHP, I'll stick with the PEAR recommendations and do the best I can with whatever is missing.
>
> Thanks.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux