Home > php教程 > php手册 > A common way to compile PHP extensions

A common way to compile PHP extensions

WBOY
Release: 2016-07-06 13:31:06
Original
961 people have browsed it

Take installing the swoole extension as an example: Step 1: wget pecl.php.net/get/swoole-1.7.21.tgz (download the swoole package file) Step 2: tar zxvfswoole-1.7.21.tgz (unzip the swoole compression file) Step 3: cd swoole-1.7.21 (enter the swoole directory) Step 4: /usr/local/php/bin/phpize (or use phpize directly

Take installing the swoole extension as an example:

Step 1: wget pecl.php.net/get/swoole-1.7.21.tgz (Download the swoole package file)

Step 2: tar zxvf swoole-1.7.21.tgz (unzip the swoole compressed file)

Step 3: cd swoole-1.7.21 (enter the swoole directory)

Step 4: /usr/local/php/bin/phpize (or use phpize directly. The phpize command is used to prepare the compilation environment of the PHP extension library, everyone The path of the phpize command may be different, do not copy and execute directly)

Step 5: ./configure --with-php-config=/usr/local/php/bin/php-config (or use ./configure directly. ./configure is used to configure the upcoming Configure the installed software and check whether the current environment meets the dependencies of the software to be installed)

Step 6: make (compile)

Step 7: make test (This step is to check the make in the previous step to ensure that there are no errors in make)

Step 8: make install

After executing make install, you will see a message similar to this:

Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/, this path is the path of the PHP extension (extension_dir), the swoole is successfully installed .so is in this directory.

Step 9: vim /usr/local/php/lib/php.ini Add extension=swoole.so

Step 10: service php-fpm restart (Restart PHP’s FastCGI process manager, Now I have written the service startup scripts for nginx and php-fpm Enter /etc/rc.d/init.d)


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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template