Home >Backend Development >PHP Tutorial >Linux compile and install php
1. http://php.net/ Download the source code of the corresponding version
2. After decompressing the source code, execute in the source code directory
<code>./configure --prefix=/usr/php --with-mysql=/mysql ext目录 <span>...</span> --enable-fpm make && make install</code>
prefix is to specify the installation directory, and with is to specify the extension to be compiled together with the source code
enable is to enable fpm. After enabling fpm, there will be an executable file php-fpm in the php installation directory sbin. The compilation of the extension can be added later or compiled together with the source code. After the = sign is the extended source code directory. The extended source code is There are two ways to obtain it. There is extended source code in the ext directory in the PHP source code. If not, you need to download the source code from other places.
3. Compile php extension separately
After installing php, there is phpize in the php/bin directory. This executable file is used to generate configure and other files. Execute it in the source code directory<code>/usr/php/bin/phpize <span>.</span>/configure <span>-with</span><span>-php</span><span>-config</span><span>=</span>/usr/php/bin/php<span>-config</span> make <span>&&</span> make install</code>
4. View php extensions. You can execute the php -m command to view the currently installed php extensions
The above introduces Linux compilation and installation of PHP, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.