Notice , the argument of your configuring the PHP! They are "/usr/src/php-5.3.10/ext [extend]" here! such as:libxml!
shell> ls
bcmath libxml ... and other modules list
------------------------------------------------------------------------------------------------
If your programmer need the bcadd() function , what shoud we do?
http-error:PHP Fatal error: Call to undefined function bcadd() in /www/test.php on line 5
It's easy! add the php patch!
shell> cd /usr/src/php-5.3.10/ext/bcmath shell> ls …… ///there are no configure file shell> /usr/local/bin/phpize //the configure file will be builded!If you reboot your OS, they will disappear again! shell> ./configure --enable-bcmath --with-php-config=/usr/local/bin/php-config shell> make shell> make install Installing shared extensions: /usr/local/lib/php/extensions/no-debug-non-zts-20090626/ ------------------------------> shell> ls /usr/local/lib/php/extensions/no-debug-non-zts-20090626/ bcmath.o
------------------------------> /usr/local/lib/php.ini
extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20090626/" //the path of patch! extension="bcmath.so"
------------------------------>
restart your apache!
-----------------------------> /www/test.php
<?php $a = '1.234'; $b = '5'; echo bcadd($a, $b) . "<br>"; // 6 echo bcadd($a, $b, 4); // 6.2340 ?>
PS: 另外,如果这样扩展模块失败的话,当然还可以重新编译一次PHP呗!将新编译好的,做一个软链呗!