Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use php dynamic extension bcmath and sockets Library Module

Shulou Source: shulou.com Published: 2022-06-03 17:42:35 11月12日 Update

This article mainly introduces php dynamic expansion bcmath and sockets library module how to use, the article introduces in great detail, has a certain reference value, interested friends must read it!

When learning to install zabbix, you need to build and use the LNMP framework, but forget to add bcmath and sockets when compiling php

Expansion package, found that the original installation did not have-- enable-bcmath,-- enable-sockets, I do not want to delete reinstalled php, fortunately php branch

To add an extension separately, it is important to generate the .so file corresponding to the extension.

The details are as follows: have the same version of the php source code installation package as the php you have installed. I use php-7.0.5.tar.gz.

[root@server ~] # tar-zxf php-7.0.5.tar.gz

[root@server ~] # cd php-7.0.5

[root@server php-7.0.5] # cd ext/

[root@server ext] # cd bcmath/

[root@server bcmath] # / usr/local/php7/bin/phpize

[root@server bcmath] # / configure-- with-php-config=/usr/local/php7/bin/php-config-- enable-bcmath

[root@server bcmath] # make

[root@server bcmath] # make test

[root@server bcmath] # make install

[root@server bcmath] # cd / usr/local/php7/lib/php/extensions/no-debug-non-zts-20151012

[root@server no-debug-non-zts-20151012] # ls

Bcmath.so opcache.an opcache.so

The module has been compiled and now added to php

[root@server no-debug-non-zts-20151012] # cd / usr/local/php7/etc/

[root@server etc] # vi php.ini

Add two lines at the end

Extension_dir=/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20090626/

Extension=mbstring.so

Restart php and nginx, and add the test module.

Problems encountered:

Add-- with-php-config=/usr/local/webserver/php/bin/php-config when compiling bcmath or the following error will occur

Configure: error: Cannot find php-config. Please use-with-php-config=PATH

[root@server bcmath] #. / configure-- with-php-config=/usr/local/webserver/php/bin/php-config is normal.

The same method is used to dynamically add sockets library modules.

Under the ext directory that is not found in the php service source code installation package, if you do not find the required loading modules (such as yaf, ffmpeg), you need to download the source code installation package by yourself. The decompressed operation is the same as the above steps.

This problem was encountered when I was doing zabbix experiments, and it deepened again in the aspect of php dynamic loading module.

These are all the contents of this article entitled "how to use php dynamic extension bcmath and sockets Library Modules". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Module dynamic compilation content time source code article question same important value practice interest premise partner that is file method is in Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Huawei Docker Shulou Tech Info Xiaomi