Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use php dynamic extension bcmath and sockets Library Module

2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report