In the daily development, as the function of development becomes more and more complex. The requirements for the operating environment are constantly being updated and changed as demand changes. An online production system cannot initially satisfy all the operational dependencies, so it is more necessary to dynamically add dependencies. If your application is based on LANMP, then there is a good chance that one day you will need to add an Apache extension or PHP extension. This time record how to add a php extension. Due to the need to access the UnionPay interface, and look at the next operating environment, found that the lack of high-precision operation of the extended Php-bcmath.
When the program runs, the following exception is reported
Php-bcmath "Fatal error:call to undefined function bcscale ()
This is why you need to install the new PHP extension with phpize Php-bcmath
1. Install Php-bcmath Extension
Cd/www/wdlinux/apache_php-5.2.17/lib/php/extensions//www/wdlinux/apache_php-5.2.17/bin/phpize./configure-- Enable-bcmath--with-php-config=/www/wdlinux/apache_php-5.2.17/bin/php-configmakemake Testmake Install
After installation, you can see the installation directory for bcmath.so
/www/wdlinux/apache_php-5.2.17/lib/php/extensions/no-debug-zts-20060613/bcmath.so
2. Add the bcmath.so extension to the php.ini
Edit/www/wdlinux/wdphp/lib/php.ini
Vi/www/wdlinux/wdphp/lib/php.iniextension= "/www/wdlinux/apache_php-5.2.17/lib/php/extensions/ No-debug-zts-20060613/bcmath.so "
3. Restart Service
Service httpd Restart
4, phpinfo () check whether the installation is successful
Create File phpinfo_test.php
Run in the browser/HTTP//your domain name/phpinfo_test.php
If the installation succeeds, you can find a result item like this
Bcmath