: This article describes how to compile and install php in linux. if you are interested in the PHP Tutorial, refer to it. 1, http://php.net/download the corresponding version of the source code
2. decompress the source code and execute it in the source code directory.
./Configure -- prefix =/usr/php -- with-mysql =/mysql ext directory... -- enable-fpmmake & make install
Prefix indicates the installation directory, and with indicates the extension that is compiled along with the source code.
Enable is to enable fpm. after fpm is enabled, an executable file php-fpm will appear in the php installation directory sbin.
Extended compilation can be added later or compiled together with the source code. the extension source code directory is followed by the = sign. the extended source code can be obtained in two ways, in the PHP source code, the ext directory contains the extended source code, which needs to be downloaded from other places to the source code.
3. Compile the php extension separately
After installing php, the executable file phpize in the php/bin directory is used to generate files such as configure and execute it in the source directory.
/Usr/php/bin/phpize./configure-with-php-config =/usr/php/bin/php-configmake & make install
If an error is reported during compilation, you can use apt-get to install other dependencies,
The php-config file is also an executable php file, which can exist in the php extension directory after completion. so file, and then in php. enable extension in ini and restart php-fpm to load the extension.
4. view the php extension and run the php-m command to view the extensions currently installed in php.
The directory where php. ini is located can be viewed in phpinfo (). If php. ini does not exist, you can copy php. ini. development from the php source code and rename it.
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.
The above describes how to compile and install php in linux, including related content, and hope to help those who are interested in PHP tutorials.