How PHP adds its own extension library

Source: Internet
Author: User
Tags xsl zts

What if PHP is already installed on the server and you need to add additional PHP extensions? No need to reinstall PHP, with Phpize we can install the extension library directly on top of the original PHP base. This compilation is just a separate compilation of PHP extensions, which will then compile the extension libraryadding to the PHP now running, does not recompile the PHP now running, so there is no impact.
Below we demonstrate the installation of XSL extensions (not necessarily common, as an example)procedure One:1. Locate the source code directory for the currently running PHP version, such as php-5.2.3. Enter 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 perform the following configure and make commands, respectively. $./configure-with-php-config=/home/app/php5.3.3/bin/php-configAfter this step is performed, the Make command is executed, and if configure execution does not pass, then the cause of the error is found. $make#make成功执行后, the resulting 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. Configuring the php.ini file#将编译好的扩展库文件复制到PHP的扩展目录下, you can view phpinfo information by: $ 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 Settings extension directory #在php the. ini file, and then 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 to see the XSL extension library that you just added. (if there are multiple PHP-FPM processes, smooth restart of the main process can be: KILL-USR2 pid)

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.