phpize FAQ_PHP Tutorial

WBOY
Release: 2016-07-14 10:07:28
Original
916 people have browsed it

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 Enter the extension directory in the source package
$ phpize runs phpize. The path is not necessarily in the current directory, find phpize and run it. A configure file will be generated later
$ ./configure Run. If you generate a database-based extension, you need to run it with parameters: 1, --with-php-config. 2, "--with-specific database parameters". For example, --with-pgsql, --with-mysql
$ make
# make install will generate an extension of extname.so, which will be placed in the 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.
The role of phpize can be understood as follows: detect the environment (the phpize tool is in the PHP installation directory, so the corresponding configure file must be generated based on the PHP configuration) and create a configure file. You must run phpize in a directory. Then phpize knows which directory your environment is, and the configure file is created in that directory.
Summary of steps:
1. cd /usr/src/php source package directory/ext/extension directory/
2./usr/local/php5314/bin/phpize
3. ./configure --with-php-config=/usr/local/php5314/bin/php-config
Note: If xampp is installed, the default is ./configure --with-php-config=/opt/lampp/bin/php-config
4. make && make install
5. The remaining step is to configure php.ini
If you have multiple versions of php installed on your server, you need to tell phpize which version of the extension you want to build based on. Specify which php version you are using by using --with-php-config=.
For example: --with-php-config=/usr/local/php524/bin/php-config
About the php-config file: It is a file placed in the installation directory after PHP is compiled and generated (installed).
Question: phpize is a file in the php installation directory. For example, if I have installed two php5.2 and php5.3, then when using phpize, I must also use the corresponding version of phpize. What is the use of --with-php-config at this time?
Where is the phpize tool generally located?
When php is compiled, there will be a phpize script file in the bin directory under the php installation directory. So go to the installed php installation directory and find
first

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...
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!