Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
238 views
in Technique[技术] by (71.8m points)

Do i need Zend framework to write PHP extension in C?

Do i need Zend extensions, or lower level Zend Engine, to create ext.so from ext.c, ext.h and config.m4 ? Is it enough to write ext.h, ext.c and config.m4 files?

old question: Do i need Zend framework to write php extension in c?

This tutorial explains ZEND. https://docstore.mik.ua/orelly/webprog/php/ch14_01.htm

This example does not use ZEND: Compiling a PHP extention library on Ubuntu (Karmic Koala)

question from:https://stackoverflow.com/questions/66054230/do-i-need-zend-framework-to-write-php-extension-in-c

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The question isn't really meaningful; you've misunderstood some terms.

  • The name "Zend" is a portmanteau of "Zeev" and "Andi", the names of two key figures in PHP's history. They used it as the brand for several of their projects.
  • "Zend Framework" is (or was) a PHP application framework, like Symfony, CakePHP, Phalcon, etc. It was recently renamed Laminas. It has nothing to do with extension development, or the core of PHP, it was just founded by Zeev and Andi.
  • "Zend Engine" is the internal compilation and execution system which PHP runs on since PHP 4.0. If you have PHP, you have the Zend Engine, it's not something you have to add separately.
  • PHP provides two different sets of extension hooks: one set is for "PHP extensions" which want to extend the PHP language (provide additional functions, objects, stream wrappers, etc); the other is for "Zend extensions" which want to extend the underlying compilation and runtime system (the Zend Engine). Most extensions you'll use are "PHP extensions"; OpCache and XDebug would be common examples of "Zend extensions".

So, to create a PHP extension, you use the set of APIs - C functions and macros - defined for that purpose, and compile the result against a copy of the PHP source (which includes the Zend Engine). If you are doing something lower-level to the language, you might instead use the set of APIs defined for "Zend extensions", and compile that.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...