search
Homephp教程php手册linux下用phpize给PHP动态添加扩展

linux下用phpize给PHP动态添加扩展

Jun 13, 2016 am 10:33 AM
linuxphpusedynamiccommonforgetExpandhourAdd toofcompile

  使用php的常见问题是:编译php时忘记添加某扩展,后来想添加扩展,但是因为安装php后又装了一些东西如PEAR等,不想删除目录重装,别说,php还真有这样的功能。

  我没有在手册中看到。

  如我想增加bcmath支持,这是一个支持大整数计算的扩展。windows自带而且内置,linux“本类函数仅在 PHP 编译时配置了 --enable-bcmath 时可用”(引号内是手册中的话)

  幸好有phpize,

  方法是,要有与现有php完全相同的php压缩包。我用的是php-5.2.6.tar.gz。

  展开后进入里面的ext/bcmath目录

  然后执行/usr/local/php/bin/phpize,这是一个可执行的文本文件,要确保它在系统中

  会发现当前目录下多了一些configure文件,

  如果没报错,则

  Php代码

  ./configure --with-php-config=/usr/local/php/bin/php-config

  注意要先确保/usr/local/php/bin/php-config存在。

  如果你的php安装路径不是默认的,要改。

  如果没有报错,则make,再make install ,然后它告诉你一个目录

  你把该目录下的bcmath.so拷贝到你php.ini中的extension_dir指向的目录中,

  修改php.ini,在最后添加一句extension=bcmath.so

  重启apache.

 

Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool