Home > Backend Development > PHP Tutorial > About php Extensions

About php Extensions

WBOY
Release: 2016-08-08 09:21:09
Original
1145 people have browsed it

Reprinted from: http://www.linuxchina.net/?p=1361

Compile and install PHP. PHP will generate many extensions. These extensions are divided into two types: dynamic and static compilation.

Dynamic compilation will automatically generate so files and save them in: $php/lib/php/extensions/no-debug-non-zts-20060613/. These so files contain function libraries that can be called by php. When the code When these function libraries need to be called, PHP will dynamically load these so files.

Static compilation means that these so files will not be automatically generated when compiling and installing php. Instead, the function libraries in these so files will be statically compiled into php, so that the code will also be called when calling.

The difference between dynamic compilation and static compilation:

During dynamic compilation, each PHP extension will generate its own so file. When the code calls these function libraries, the corresponding so file will be dynamically loaded, which can optimize the code execution time and control PHP The size of the memory; although static compilation can also make the code call the corresponding function library, in the case of high concurrency, loading all PHP function libraries will bring more memory consumption and affect server performance.

Implementation of dynamic compilation and static compilation:

Dynamic compilation needs to specify the parameter shared during configuration, for example:
-with-zlib=shared -with-pdo-mysql=shared,/usr/local/mysql
Static compilation There is no need to specify the parameter shared, for example: -with-zlib

The above has introduced About php Extensions, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template