PHP扩展模块安装
1、查看模块是否安装并进入php模块的安装目录
创新互联建站基于成都重庆香港及美国等地区分布式IDC机房数据中心构建的电信大带宽,联通大带宽,移动大带宽,多线BGP大带宽租用,是为众多客户提供专业服务器托管报价,主机托管价格性价比高,为金融证券行业成都棕树电信机房,ai人工智能服务器托管提供bgp线路100M独享,G口带宽及机柜租用的专业成都idc公司。
[root@daixuan ext]# /usr/local/php/bin/php -m | grep -i curl
[root@daixuan ext]# pwd
/usr/local/src/php-5.4.45/ext
[root@daixuan ext]# ls 所有的模块都是可以安装的,部分已经安装
curl mssql pdo_oci simplexml tokenizer
gettext MySQL pdo_odbc skeleton
date gmp mysqli wddx
[root@daixuan ext]# cd curl
[root@daixuan curl]# ls
config.m4 CREDITS interface.c package.xml streams.c
config.w32 curl.dsp multi.c php_curl.h tests
2、生成curl的模块configure可执行文件
[root@daixuan curl]# /usr/local/php/bin/phpize 生成configure可执行文件
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
[root@daixuan curl]# ls
acinclude.m4 config.h.in config.w32 ltmain.sh package.xml
aclocal.m4 config.m4 CREDITS Makefile.global php_curl.h
autom4te.cache config.sub curl.dsp missing run-tests.php
build configure install-sh mkinstalldirs streams.c
config.guess configure.in interface.c multi.c tests
3、配置编译参数(如果有错,可能是缺少库)
[root@daixuan curl]# ./configure --with-php-config=/usr/local/php/bin/php-config
4、编译
[root@daixuan curl]# make
Build complete.
Don't forget to run 'make test'.
5、安装
[root@daixuan curl]# make install
Installing shared extensions:/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/
[root@daixuan curl]# ls /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/
curl.so
6、配置PHP.ini添加curl.so模块
[root@daixuan curl]# vim /usr/local/php/etc/php.ini
添加一行:extension=curl.so
[root@daixuan curl]# /usr/local/php/bin/php -m
[PHP Modules]
bz2
Core
ctype
curl 发现curl动态模块已经加载
[root@daixuan curl]# vim vim /usr/local/php/logs/php_errors.log 如果不能加载,查看错误日志
[root@daixuan curl]# grep '^extension=' /usr/local/php/etc/php.ini 查看已经加载的动态模块
extension=curl.so
知识点:extension.dir是存放扩展模块的,在哪里呢?
[root@daixuan curl]# /usr/local/php/bin/php -i | grep extension.dir
extension_dir => /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525 => /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525
sqlite3.extension_dir => no value => no value
[root@daixuan curl]# ls /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525
curl.so
如果想修改extension.dir(扩展模块的默认目录),该怎么做呢?
[root@daixuan curl]# vim /usr/local/php/etc/php.ini
; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
; extension_dir = "./"
; On windows:
; extension_dir = "ext" 将其修改为指定的目录
标题名称:PHP扩展模块安装
浏览路径:http://ybzwz.com/article/iesjsd.html