Previously thought that PHP extension to recompile PHP, today, under the guidance of the Group of friends know can be like Apache module dynamic expansion, to mcrypt example. Enter the source directory of the extension to be installed
Cd/root/php-5.2.6/ext/mcrypt
Run Phpize
/usr/local/php5/bin/phpize
[ANSI] [Email protected] MCrypt $/usr/local/php5/bin/phpize
Configuring for:
PHP Api version:20041225
Zend Module Api no:20060613
The Zend Extension Api no:220060519 appears with such hints that can be extended. Then compile and install #./configure--with-php-config=/usr/local/php5/bin/php-config
#make #make Install
Installing Shared extensions:/usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/ Remember the path to the hint here just compiled the module right here
[ANSI] [Email protected] MCrypt $CD/usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/
[ANSI] [Email protected] no-debug-non-zts-20060613 $ls
eaccelerator.so mcrypt.so memcache.so
Then edit php.ini (if PHP is installed in/usr/local/php5 php.ini add in/usr/local/php5/lib/php.ini
Extension_dir = "/usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/"
Extension = "mcrypt.so" then restarts Apache and then accesses phpinfo.php to see the support MCrypt.
The common use of PHP is: Compile php forget to add an extension, and then want to add extensions, but because the installation of PHP after installing some things such as pear, do not want to remove the directory reload, don't say, PHP really has such a function.
I didn't see it in the manual.
If I want to add bcmath support, this is an extension that supports large integer calculations. Windows comes with and built-in, Linux "This type of function is only available when PHP is configured with--enable-bcmath" (in quotation marks in the manual)
Fortunately there are phpize,
The method is to have PHP compression packages that are identical to the existing PHP. I'm using a php-5.2.6.tar.gz.
Expand into the inside of the Ext/bcmath directory
Then execute/usr/local/php/bin/phpize, which is an executable text file, to make sure it's in the system
Will find some configure files in the current directory,
If there is no error, then
PHP code
./configure--with-php-config=/usr/local/php/bin/php-config
Be careful to make sure that/usr/local/php/bin/php-config exists first.
If your PHP installation path is not the default, change it.
If there is no error, make, then make install, then it tells you a directory
You copy the bcmath.so in the directory to the directory in the Extension_dir point of your php.ini,
Modify PHP.ini, add a sentence at the end extension=bcmath.so
Restart Apache.
Teach you how to dynamically install the PHP extension module
When PHP is installed, some modules may be missing during the initial installation, but we do not want to recompile PHPbecause the time-consuming is longer. Can we add a single module to PHP without recompiling the PHP installation? Find information, found there are methods, the focus is phpize, so wrote this article.
Here's an example of how to add a module to PHP dynamically by loading the MYSQLI module separately for PHP.
1, find php original code installation files 2, Cd/home/php/ext/myslqi3, run/usr/local/php/bin/phpize4,/configure–with-php-config=/usr/local/php/ Bin/php-config5, make && makes install6, after installation, will be/usr/local/php/lib/php/extensions/in the system no-debug-non-zts-20060613/This directory generates mysqli.so library file 7, edit php.ini file, specify PHP to which person directory read Module vi/usr/local/php/etc/ Php.iniextension_dir= "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613″extension=mysqli.so8, restart PHP service /USR/LOCAL/PHP/SBIN/PHP-FPM Restart7,/usr/local/php/bin/php-m|grep mysqli see if mysqli.so exists
If the steps are correct and your population is not poor, it should be done with PHP's dynamic module loading.
PHP Installation Extensions