博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
使用phpize增加php模块
阅读量:7254 次
发布时间:2019-06-29

本文共 3007 字,大约阅读时间需要 10 分钟。

一,phpize的好处

什么时候我们要用phpize呢?我们在安装php时:

./configure --prefix=/apps/product/php --with-config-file-path=/apps/product/php/etc \--with-iconv-dir --with-freetype-dir --with-png-dir --with-zlib --with-libxml-dir=/usr  \--enable-xml --enable-discard-path --enable-safe-mode --enable-bcmath \--enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl \--with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm \

后面根的参数是我们要的模块,但是随着工作的需要,我们还要在加些模块,又不想重新编译php,这些我们就可以用phpize了。

二,安装php模块

下面我以gd模块安装为例子:

cd /apps/product/php-5.6.10/ext/gd                #ext目录下面放的是php的模块库/apps/product/php5/bin/phpize#确定php-config文件是否存在,调用php-config,安装后.so文件会自动放到extension_dir里面./configure --enable-gd --with-php-config=/apps/product/php5/bin/php-configmake && make install

安装完后会有这样的东西

See any operating system documentation about shared libraries formore information, such as the ld(1) and ld.so(8) manual pages.----------------------------------------------------------------------Build complete.Don't forget to run 'make test'.Installing shared extensions:     /app/product/php5/lib/php/extensions/no-debug-non-zts-20060613/

三,查看.so文件,以及修改php.ini

cd  /app/product/php5/lib/php/extensions/no-debug-non-zts-20060613/ls -al |grep gd-rwxr-xr-x 1 root  root   763334 Feb  9 10:51 gd.sovi  /app/product/php5/lib/php.ini在加载模块的地加上一行extension=gd.so

四,重起phpf服务

查看编译的模块:

/apps/product/php5/bin/php -i|grep configure/apps/product/php5/bin/php -m 

php 开启openssl扩展:(当时没测试成功,只能重新编译安装了)

#进入源码目录:cd /usr/local/src/php-7.0.14/ext/openssl[root@supplier-pre01 openssl]# /usr/local/php7/bin/phpizeCannot find config.m4. Make sure that you run '/usr/local/php7/bin/phpize' in the top level source directory of the module[root@supplier-pre01 openssl]# [root@supplier-pre01 openssl]# mv config0.m4 config.m4[root@supplier-pre01 openssl]# /usr/local/php7/bin/phpizeConfiguring for:PHP Api Version:         20151012Zend Module Api No:      20151012Zend Extension Api No:   320151012[root@supplier-pre01 openssl]# [root@supplier-pre01 openssl]# ./configure --with-openssl --with-php-config=/usr/local/php7/bin/php-config  checking for grep that handles long lines and -e... /bin/grepchecking for egrep... /bin/grep -Echecking for a sed that does not truncate output... /bin/sedchecking for cc... ccchecking for C compiler default output file name... a.outchecking whether the C compiler works... yes......creating libtoolappending configuration tag "CXX" to libtoolconfigure: creating ./config.statusconfig.status: creating config.h[root@supplier-pre01 openssl]# make && make install----------------------------------------------------------------------Build complete.Don't forget to run 'make test'.Installing shared extensions:     /usr/local/php7/lib/php/extensions/no-debug-non-zts-20151012/执行安装后,会提示在某个目录生成.so文件,我生成的位置在/usr/local/php7/lib/php/extensions/no-debug-non-zts-20151012/打开php.ini,添加下面两句话.vim /usr/local/php7/etc/php.ini extension_dir = "/usr/local/php7/lib/php/extensions/no-debug-non-zts-20151012/"  extension=openssl.so

 

转载地址:http://qdkdm.baihongyu.com/

你可能感兴趣的文章
理解爬虫原理
查看>>
Linux 多线程
查看>>
iOS“.NET研究”平台应用开发的敏捷设计流程
查看>>
sqlite数据库中自增key的设定,autoincrement 和 rowid
查看>>
【推荐】10款优秀的jQuery图片插件
查看>>
黑帽大会:SCADA系统安全就像一颗“定时炸弹”
查看>>
20165303第九周学习总结
查看>>
sql存储过程中的整形变量和字符串变量
查看>>
WebService 调用三种方法
查看>>
自定义web框架
查看>>
java集合架构(二)——Map
查看>>
课堂实验
查看>>
The King’s Ups and Downs
查看>>
JRadioButton 实现图片切换
查看>>
图片和字符串相互转换
查看>>
动态规划,Dijkstra算法,A*算法的比较
查看>>
[笔记]sql server 单用户切换
查看>>
ios专题 - 图片(UIImage)获取方法
查看>>
iOS应用性能调优的25个建议和技巧
查看>>
LINUX常用命令--基础篇(一)
查看>>