Different projects, different PHP

Source: Internet
Author: User
Tags php database
A large project here refers to a distributed project, that is, your program needs to be arranged on N servers. At this level, PHP does not have much support than j2ee. I have discussed with shadow 735 that PHP needs to solve some titles in large systems. of course, these titles are not only the titles of PHP but also the titles of peripheral development.

On the homepage, I saw an article about PHP's Web-based goal optimization. I also had a few blank words.

PHP is a very good tool, which can be simple or complex. Different projects should use different PHP.

Small Project-simple and direct PHP

Generally, for a website with a function page under 20, we can use a simple framework structure to write it. In this scope, I suggest that you use a more direct process-oriented coding method. The reason is very simple. there is no need to add N to the class file, and the result is that there is a new in the controller. Of course, except for projects that require frequent changes.

At this level, the advantages of php are obvious: rapid development, clear at a glance. The problem is also hidden.

Medium-sized Projects-beautifully structured, OO PHP

For a medium-sized project, I suggest applying a well-designed framework, which can be based on the MVC model and encapsulates many underlying controls. of course, there must be a good, preferably transparent cache mechanism. in this way, the OO mechanism we participate in to adapt to changes can run faster and better.

At this level. The emergence of php problems, such as the incomplete OO support (this PHP5 has been greatly improved), only single thread mode. In addition, some peripheral tools lack support at the beginning, such as PHP's lack of good refactoring tools, and lack of good integration into the unit test tools in IDE. Strengths are of course the original rapid development and extensive open-source resources available.

Large projects-expanded and optimized PHP

A large project here refers to a distributed project, that is, your program needs to be arranged on N servers. At this level, PHP does not have much support than j2ee. I have discussed with shadow 735 that PHP should use some titles to solve in large systems. of course, these titles are not only the titles of PHP language, it also contains the title of the surrounding development:

1. PHP page code sharing. after the PHP source code is loaded into the memory once, it will be retained in it-this can be done with the APC and Zend Optimizer.

2. data objects are shared between PHP pages.. php and B. php can share a data object, such as an array, which can be serialized now, but there will be file io, which can be processed using shared memory or memcached.

3. PHP database connection pool. due to the fact that PHP cannot control the connection to the database many times ago, it is necessary to create a connection pool before the database, similar to sqlrelay. In addition, the data cache is also very important. there is a tip for high-pressure development, that is, the database can not be moved without moving it.

4. PHP front-end cache system. A transparent and controllable cache mechanism ensures that the website page queries the database at least times. This has many implementations, but it is not particularly good.

5. when talking about the above, the car arrived.

At this level, we will no longer talk about the advantages and disadvantages. what is important is to integrate PHP java C python and so on to make it an efficient system. We can use memcached for distributed memory management, Lucene for full-text retrieval, ejb containers for some business logic components, and PHP for front-end and system glue, quickly and flexibly bond these things.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.