Php extension and embedding-General Outline _ PHP Tutorial

Source: Internet
Author: User
Tags php book php debugger
Php extension and embedding-general principles. I got started with php development and php extensions, and found that extendingandembededphp is a very good book, and many questions are also very thorough. Some of the books I have read are initially related to php development and php extensions. I found that extending and embeded php are very good and many questions are also very thorough. Here, we will combine the content of some books we have read with our own practices to show that we are not only keeping a document for ourselves, but also inspiring others. We look forward to the guidance of php experts.

The extending and embeded php book also has a Chinese version. For more information, see:
Http://www.walu.cc/phpbook/preface.md

This book focuses on two aspects:
  • How to expand php by adding functions, classes, resources, and streams

  • How can we embed the php language into other applications? why is php extension required? :
    • Connect to additional libraries and provide scripts for user space in the form of APIs. For example, the encapsulated mysql
      • It provides an extension between a third-party library and the php core. Therefore, php is called the glue language.
      • Perform special internal operations, such as declaring Super variables.The user space is restricted due to security reasons. For example, php's advanced php debugger and runkit mainly work on this.
      • Speed reason: Token-based, compiled, and run. Opcode can be reduced in the first two steps, but it is better to execute this step in C code.
      • Provides functions without exposing the source code.
        The overall structure of php is given:

        The functions of each module are as follows:
        SAPI: interface layer with web server PHP Core: connection layer for Core events, processing operations similar to file processing and error handling Zend Engine: compile scripts into machine languages, execute bytecode, read and write user space variables, control program streams, and parse extensions. TSRM: thread safe resource management: enables a single php instance to simultaneously process many independent requests. This book consists of three parts, the first part is a reintroduction to php, which mainly describes how php interpreters are combined. The second part focuses on php extension, which involves the following aspects:
        • Php api some php internal functions and macros
        • How to convert a php script into a c code: the corresponding processing of c language is involved in every php script, which is very useful for extended development.
        • Perform operations that are not possible in the user space: in most cases, you need to execute actions that are not completed in the user state similar to Super variables. in this case, you need to use extensions for corresponding processing. The third part describes how to embed php into the corresponding application:
          • First, add corresponding php support to the application
          • Second, make full use of the corresponding security features of php
          • The last step is to explain how php can process multiple requests at the same time. as we have just started learning php, some errors are inevitable. please correct me.

            Movie and embeded php this book is very good, many questions are also very thorough. Here we will read some of the content in the book...

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.