PHP補丁[LAMP]

lin.tao發表於2012-09-11

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唄!將新編譯好的,做一個軟鏈唄!



相關文章