Php has a Zend Engine.. The zend engine provides fopen.. Php also provides fopen…
But when we call fopen, php’s fopen is called.. I have three questions here
- What is the purpose of the /php–Nn/ext folder .
- Do the functions in ext folder need to be recompiled everytime they are changed?
- Do the functions in the ext folder (if they happen to have same name as zend functions) over-ride the zend functions..
It contains the PHP extensions, i.e., the things built on top of the Zend Engine that actually provide PHP functions and the built-in objects.
Yes, if you want the change to be reflected in the binaries.
You’re mistaken, the Zend Engine does not define the PHP function
fopen.In fact, the Zend Engine provides no PHP functions.It can be compiled independently and used for something completely unrelated to PHP. The Zend Engine actually provides a few PHP functions (declared withZEND_FUNCTION), seezend_builtin_functions.c.PHP_FUNCTIONis actually a synonymous toZEND_FUNCTION, but relying onZEND_FUNCTIONto declare PHP functions is an abstraction violation.You may be confusing the PHP function function (declared internally as
PHP_FUNCTION(fopen)) with some other C function calledfopen(like the one in the standard C library).As to whether Zend provides a file open function… What I could find:
zend_stream_open, whose call hierarchy suggests is used when openingincludefiles.I imagine the reason for providing a global with a function pointer is so that it can be substituted for e.g. TSRM or the Phar extension.