PHP Under what circumstances need to use C extension, Daniel Guidance, say a specific application scenario, very grateful!

Source: Internet
Author: User
PHP Under what circumstances need to use C extension, Daniel Guidance, say a specific application scenario, very grateful!

Reply content:

PHP Under what circumstances need to use C extension, Daniel Guidance, say a specific application scenario, very grateful!

    • Performance optimizations when encountering performance bottlenecks, such as dense computing, large string processing, etc.
    • Communicate across processes, share data, such as global data tables, configuration files, database connection pools, and more
    • PHP needs to use some local C library or executable functions, these features are not implemented in PHP, such as ImageMagick, such as the image processing tool

I am based on the actual things to say, I do a two-time extension, one is to call the company's ID generator, the program is C write (some mature algorithm inside, take PHP to write again instead of trouble), another is to use the V8JS but it does not fully meet our needs, So changed the next source (in fact, this is not the expansion of their own, or from the PECL to take).

What I feel is that performance, process communication, and shared data are not really necessary to be expanded. 1. How much performance do you need PHP to improve? PHP's advantages in web development is convenient, mature components and frameworks, rather than performance 2. Process communication has pcntl and POSIX, signals, pipelines are not easy (but frankly not as good as Perl multi-process) 3. Sharing data finding a NoSQL database is better, if it needs to be processed in real time, There are many applications such as Message Queuing.

Therefore, I think the real need to expand the main or is forced by the environment, there is a program of their own, he has no PHP version, how do you do it. Of course it may also be because of the performance of the core components written in C, but there seems to be very few projects that require, at least I went through the work, if it must be high-performance distributed computing, through the custom interface or Message Queuing interactive data, or scheduled tasks timed trigger, or task Queue batch processing, does not mix with web systems at all.

Generate the activation code and so on, the decryption function is written in C extension

  • 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.