How to add built-in extension libraries in PHP

Source: Internet
Author: User
Tags zts
How does one add a built-in extension library for PHP? what should I do when PHP has been installed on the server and requires additional extensions for PHP? You do not need to reinstall PHP. with phpize, you can directly install the extension library on the basis of the original PHP.

This compilation only compiles the PHP Extension Library separately, and then adds the compiled extension library to the currently running php. This does not affect the current php re-compilation.


Next we will demonstrate how to install xsl extensions (not necessarily common, just as an example)

Practice 1:

1. find the source code directory of the currently running php version, such as the php-5.2.3. Go to the xsl Extension Library Directory.

$ Cd/home/pkgs/php-5.3.3/ext/xsl


2. call the phpize program to generate the compilation configuration file.

$/Home/app/php5.3.3/bin/phpize


3. Compile the extension library and execute the following configure and make Commands respectively.

$./Configure-with-php-config =/home/app/php5.3.3/bin/php-config

After this step is passed, execute the make command. if configure fails, find the cause of the error.

$ Make

# After make is successfully executed, the generated extension library file is in the modules subdirectory of the current directory,

Such as/home/php-5.3.3/ext/curl/modules/xsl. so


4. configure the php. ini file

# Copy the compiled extension library file to the PHP extension directory and view the phpinfo information ..

$ Cp/home/pkg/php-5.3.3/ext/xsl/modules/xsl. so/home/app/php5.3.3/lib/php/extensions/no-debug-non-zts-20090626

# Locate the location for setting the extension directory in the php. ini file, set the extension path to the Apache2modules directory, and add the extension Library location.

Extension_dir/home/app/php5.3.3/lib/php/extensions/no-debug-non-zts-20090626"

Extension = xsl. so

5. restart php and view the phpinfo information. the added xsl Extension Library is displayed. (If multiple php-fpm processes exist, restart the main process: kill-USR2 pid)

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.