如何利用phpize在生产环境中为php添加新的扩展php-bcmath
在日常的开发当中,随着开发的功能越来越复杂。对运行环境的要求也就随着需求的变化需要不断地更新和变化。一个在线的生产系统不可能一开始就满足了所有的运行依赖,因此动态地添加依赖就显得比较必要了。如果你的应用是基于lanmp的话,那么很有可能某天需要添加一个apache的扩展或者php的扩展。此次记录一下如何添加一个php的扩展。由于需要接入银联的接口,而查看了下运行环境,发现缺少了高精度运算的扩展php-bcmath。
程序运行的时候报如下异常
php-bcmath【Fatal error: Call to undefined function bcscale()
因此此处需要用phpize进行安装新的php扩展php-bcmath
1、安装php-bcmath扩展
cd /www/wdlinux/apache_php-5.2.17/lib/php/extensions//www/wdlinux/apache_php-5.2.17/bin/phpize./configure --enable-bcmath --with-php-config=/www/wdlinux/apache_php-5.2.17/bin/php-configmakemake testmake install
安装好以后可以看到bcmath.so的安装目录为
/www/wdlinux/apache_php-5.2.17/lib/php/extensions/no-debug-zts-20060613/bcmath.so
2、将bcmath.so扩展添加到php.ini
编辑/www/wdlinux/wdphp/lib/php.ini
vi /www/wdlinux/wdphp/lib/php.iniextension="/www/wdlinux/apache_php-5.2.17/lib/php/extensions/no-debug-zts-20060613/bcmath.so"
3、重启服务
service httpd restart
4、phpinfo()检查是否安装成功
创建文件phpinfo_test.php
<?php phpinfo()?>
在浏览器中运行http://你的域名/phpinfo_test.php
如果安装成功,你可以找到这样的结果项
bcmath
BCMath support | enabled |

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Alipay PHP...

Session hijacking can be achieved through the following steps: 1. Obtain the session ID, 2. Use the session ID, 3. Keep the session active. The methods to prevent session hijacking in PHP include: 1. Use the session_regenerate_id() function to regenerate the session ID, 2. Store session data through the database, 3. Ensure that all session data is transmitted through HTTPS.

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

How to debug CLI mode in PHPStorm? When developing with PHPStorm, sometimes we need to debug PHP in command line interface (CLI) mode...

The application of SOLID principle in PHP development includes: 1. Single responsibility principle (SRP): Each class is responsible for only one function. 2. Open and close principle (OCP): Changes are achieved through extension rather than modification. 3. Lisch's Substitution Principle (LSP): Subclasses can replace base classes without affecting program accuracy. 4. Interface isolation principle (ISP): Use fine-grained interfaces to avoid dependencies and unused methods. 5. Dependency inversion principle (DIP): High and low-level modules rely on abstraction and are implemented through dependency injection.

How to automatically set the permissions of unixsocket after the system restarts. Every time the system restarts, we need to execute the following command to modify the permissions of unixsocket: sudo...

Sending JSON data using PHP's cURL library In PHP development, it is often necessary to interact with external APIs. One of the common ways is to use cURL library to send POST�...

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.
