CentOS Install PHP extensions (bcmath)

Source: Internet
Author: User
Tags install php centos

CentOS after the mysql+apache+php, found that some of the pages open is blank.
Will php.ini inside the parameters

error_reporting = E_all,display_errors = On,display_startup_errors = On

After setting, the error reason Fatal error:call to undefined function bcmath () in/var/www/html/is displayed on the Web page. On line 95
Look up the reason is because PHP did not add bcmath extension reason, so use the following method to add the OK.
For phpize installations, on Linux machines, there are YUM commands on the line. Phpize is part of the Php-devel, so just run yum install Php-devel on the line.

How easy it is to forget something. Write down the backup;

Linux dynamically add extensions to PHP with Phpize

The common problem with PHP is that when you compile PHP, you forget to add an extension, and then you want to add an extension, but because you install PHP and then installed something such as pear, do not want to delete the directory reload, here will need to use phpize.

As I want to add support for the Bcmath extension, this is an extension that supports large integer computations. Windows is self-contained and built-in, and Linux "This class of functions is available only when--enable-bcmath is configured at PHP compile time" (in quotes, in the manual)

Note that some extensions need to be consistent with the version of PHP, so download the PHP package as much as possible and keep the version of the PHP package installed. For example, I installed the php5.1.6, download the php-5.1.6.tar.gz package

Unpack the php-5.1.6.tar.gz package, enter the inside of the Ext/bcmath directory, and then execute/usr/local/php/bin/phpize, (in fact, in the PHP source installation package inside, the path here is not absolute, According to their own path input) phpize after the installation of PHP will have this command, will find that the current directory more than some configure files, and then execute./configure command.

#/usr/local/php/bin/phpize
#./configure--with-php-config=/usr/local/php/bin/php-config

Be careful to ensure that/usr/local/php/bin/php-config exists first. (If your PHP installation path is not the default, please modify the path for PHP installation)

If there is no error, make, then make install, and then it tells you a directory.

#make
#make Install

You copy the bcmath.so in the directory to the Extension_dir point in your php.ini.

Modify PHP.ini, add a sentence at the end

Extension=bcmath.so

Restart the Web service, and then execute Phpinfo (), Surprise discovery:

To this Bcmath extension has been successfully installed.

Original address: http://blog.haohtml.com/archives/6118

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.