Use phpize in linux to dynamically add extensions to PHP

Source: Internet
Author: User

A common problem with using php is: I forgot to add an extension when compiling php. I want to add an extension later. But I didn't want to delete the Directory and reinstall it because I installed something like PEAR after installing php, let alone, php has such a function.

I did not see it in the manual.

If I want to add bcmath support, this is an extension that supports big integer computing. Windows built-in and built-in. in linux, "This type of function is only available when PHP is compiled and configured -- enable-bcmath" (in the manual quotation marks)

Fortunately, phpize,

The method is to have a php compressed package identical to the existing php. I use php-5.2.6.tar.gz.

Expand and enter the ext/bcmath directory.

Then run/usr/local/php/bin/phpize. This is an executable text file. Make sure it is in the system.

Some configure files are added to the current directory,

If no error is reported

Php code

./Configure -- with-php-config =/usr/local/php/bin/php-config

Make sure that/usr/local/php/bin/php-config exists.

If your php installation path is not the default one, change it.

If no error is reported, make, make install again, and then it tells you a directory

Copy the bcmath. so file in this directory to the directory pointed to by extension_dir in your php. ini file,

Modify php. ini and add extension = bcmath. so

Restart apache.

 

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.