phpize常见问题说明_PHP教程

php中文网
发布: 2016-07-14 10:07:28
原创
1151人浏览过

Compiling shared PECL extensions with phpize

 
Sometimes, using the pecl installer is not an option. This could be because you're behind a firewall, or it could be because the extension you want to install is not available as a PECL compatible package, such as unreleased extensions from SVN. If you need to build such an extension, you can use the lower-level build tools to perform the build manually.
 
The phpize command is used to prepare the build environment for a PHP extension. In the following sample, the sources for an extension are in a directory named extname:
 
$ cd extname  进入到源码包中的扩展目录
$ phpize  运行phpize。路径不一定在当前目录下,去寻找phpize运行。之后会生成了一个configure文件
$ ./configure     运行。    如果生成基于数据库的扩展,需要加上参数运行:1,--with-php-config。2,"--with-具体的数据库参数".比如, --with-pgsql、--with-mysql
$ make
# make install 将会生成一个extname.so的扩展,被放到了PHP extensions directory
 
 
A successful install will have created extname.so and put it into the PHP extensions directory. You'll need to and adjust php.ini and add an extension=extname.so line before you can use the extension.
 
If the system is missing the phpize command, and precompiled packages (like RPM's) are used, be sure to also install the appropriate devel version of the PHP package as they often include the phpize command along with the appropriate header files to build PHP and its extensions.
 
Execute phpize --help to display additional usage information.
 
 
phpize的作用可以这样理解:侦测环境(phpize工具是在php安装目录下,所以是要根据该php的配置情况生成对应的configure文件),建立一个configure文件。必须在一个目录下去运行phpize。那么phpize就知道你的的环境是哪个目录,并且configure文件建立在该目录下。
步骤总结:
一、cd /usr/src/php源码包目录/ext/扩展目录/  
 
二、/usr/local/php5314/bin/phpize
三、./configure --with-php-config=/usr/local/php5314/bin/php-config
注:xampp安装的话默认用 ./configure --with-php-config=/opt/lampp/bin/php-config
 
四、make && make install
 
五、剩下是配置php.ini
 
 
假如你的服务器上安装了多个版本php,那么需要告诉phpize要建立基于哪个版本的扩展。通过使用--with-php-config=指定你使用哪个php版本。
 
比如:--with-php-config=/usr/local/php524/bin/php-config  
 
关于php-config文件:是在php编译生成后(安装好),放在安装目录下的一个文件。
 疑问:phpize是在php安装目录下的一个文件。比如我安装了两个php5.2 和php5.3那么使用phpize也要使用对应版本的phpize才行吧,此时使用--with-php-config有什么作用?
phpize工具一般在哪里?
当php编译完成后,php安装目录下的bin目录下会有phpize这个脚本文件。所以是去安装好的php安装目录先去找

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/477864.htmlTechArticleCompiling shared PECL extensions with phpize Sometimes, using the pecl installer is not an option. This could be because youre behind a firewall, or it could be because the extensio...
相关标签:
PHP速学教程(入门到精通)
PHP速学教程(入门到精通)

PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号