Home >Backend Development >PHP Problem >How to install new modules in php
After php is installed, some modules may be missing during the initial installation, but we don’t want to recompile php because it takes a long time. Can we add a separate module to PHP without recompiling and installing PHP?
Related recommendations: "php Getting Started Tutorial"
Below we will take loading the mysqli module for php alone as an example to demonstrate how to dynamically add modules to php.
1. Find the php source code installation file
2. cd /home/php/ext/myslqi
3. Run /usr/local/php/bin/phpize
4./configure –with-php-config=/usr/local/php/bin/php-config
5. make && make install
6. Installation completed Afterwards, the mysqli.so library file will be generated in the system /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/ directory
7. Edit the php.ini file , specify php to the directory to read the module
vi /usr/local/php/etc/php.ini
extension_dir="/usr/local/php/lib/php/extensions/no -debug-non-zts-20060613″
extension=mysqli.so
8. Restart the php service/usr/local/php/sbin/php-fpm restart
9. /usr/local/php/bin/php -m|grep mysqli Check whether mysqli.so exists
The above is the detailed content of How to install new modules in php. For more information, please follow other related articles on the PHP Chinese website!