php 单文件基本扩展
cd php-5.3.14/ext
2 |
./ext_skel --extname=int_ext |
2,修改编译参数
1 |
cd php-5.3.14/ext/int_ext |
2 |
vi config.m4 |
去掉 PHP_ARG_ENABLE(int_ext, whether to enable int_ext support 和
[ --enable-int_ext Enable int_ext support]) 两行前面的dnl 修改后为:
1 |
1. dnl Otherwise use enable: |
2 |
2. PHP_ARG_ENABLE(int_ext, whether to enable int_ext support, |
3 |
3. dnl Make sure that the comment is aligned: |
4 |
4. [ --enable-int_ext Enable int_ext support]) |
bin文件夹里面的文件是二进制文件,是可执行文件 phpize文件和php-config文件比较重要
- ./ext_skel --extname=laiwenhui
进入文件夹修改头文家和源文件,然后进行编译
/usr/bin/phpize
./configure --with-php-config=/usr/bin/php-config
- make
- make install
- 我的PHP安装路径为:/opt/module/php
- 这个时候会生成一个文件/opt/module/php/lib/php/extensions/no-debug-non-zts-20060613/laiwenhui.so
xxx.so文件放在一个统一目录
然后配置php.ini下的指定路径
---最后操作:
当重启apache后,还是无法执行相应函数,那就需要配置extension=example.so
-----------------------
寻找文件路径:find / -name php
查询软件安装路径
在Linux操作系统中查看软件安装路径是通过whereis 命令,如查看php软件的安装路径时输入命
#whereis php
------
/usr/bin/php -m
检查php扩展的
参考文档:http://www.dewen.org/q/1507