How to add a new extension to PHP in a production environment using Phpize Php-bcmath

Source: Internet
Author: User
Tags zts
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

Bcmath Support Enabled
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.