Home  >  Article  >  Backend Development  >  How to compile and expand PHP

How to compile and expand PHP

藏色散人
藏色散人Original
2021-05-21 10:04:112838browse

How to compile and expand PHP: 1. Download the source code package; 2. Enter the decompressed directory; 3. Dynamically create the extended configure file according to the current PHP version; 4. Execute "php-config"; 5. Compile and install; 6. Introduce extensions; 7. Restart apache.

How to compile and expand PHP

The operating environment of this article: ubuntu 16.04 system, PHP7.1 version, DELL G3 computer

php extension compilation method

php has been compiled under linux, how to add new extensions to php

Through the phpize that comes with php, for example, my phpize is in /usr/local/php/bin/phpize

1. Go to the official website of the software or pecl.php.net to download the source code package

2. Unzip and enter the decompressed directory

3. Dynamically based on the current PHP version Create an extended configure file

/usr/local/php/bin/phpize

4. Use the generated configure file to execute

./configure --with-php-config=/usr/local/php/bin/php-config

5. Compile and install

make && make install

6. Expand the generated .so in php Introduced in .ini (the extension directory can be viewed with phpinfo extension_dir)

extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/扩展.so

7. Restart apache

service httpd restart

Recommended study: "PHP Video Tutorial"

The above is the detailed content of How to compile and expand PHP. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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