How to add php extensions in linux (taking pcntl as an example)

Source: Internet
Author: User
Recently I started to learn how to use php's pcntl to implement "Multithreading", while the company's LAMP environment does not have pcntl extension.

Recently I started to learn how to use php's pcntl to implement "Multithreading", but the company's LAMP environment does not have pcntl extension.

The following method is found on the Internet:

# Cd/usr/local/src/php-5.2.6/ext/pcntl
# Phpize
#./Configure -- with-php-config =/usr/local/php/bin/php-config
# Make & make install
Add the pcntl. so extension to php. ini.

The following is a brief analysis:

In the first line, we first enter the cd/usr/local/src/php-5.2.6/ext/pcntl Directory. by default, every extension of php downloaded has a directory, and you can choose partial compilation, it can be used in programming only after compilation.

In the second line, we generate a compilable file through phpize.

The third and fourth lines are our compilation process. after completion, a pcntl. so file will be generated.

The fifth line adds our pcntl. so extension to php. ini.

Note that you must check whether the directory location of the generated pcntl. so is consistent with the extension_dir = in php. ini. If they are inconsistent, move pcntl. so to the directory specified by extension_dir.

Of course, this is just an example using pcntl. This is roughly the case when you install other extensions of php.

Related Article

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.