PHP manually add an extension library under Linux

Source: Internet
Author: User
Tags zts

1. Go to the Ext directory in the PHP source directory, where the source code of each extension module is stored, and select the module you need, such as the Curl module:

CD Curl

Execute phpize to generate the compiled file, phpize in the bin directory of the PHP installation directory

/usr/local/php/bin/phpize

At run time, you may get an error: Cannot find autoconf. Please check your autoconf installation and the $PHP _autoconf

environment variable is set correctly and then rerun this script. ", you need to install autoconf:

Yum Install autoconf (redhat or CentOS), Apt-get install autoconf (Ubuntu Linux)

Build the configuration file and compile the build module:

/usr/local/php/bin/phpize

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

650) this.width=650; "Title=" image (5) "border=" 0 "alt=" image (5) "src=" http://images2015.cnblogs.com/blog/605186/ 201512/605186-20151216092403631-1014627595.png "width=" 543 "height=" 491 "style=" border:0px;padding-top:0px; Padding-left:0px;padding-right:0px;background-image:none; "/>


Make


650) this.width=650; "Title=" image (6) "border=" 0 "alt=" image (6) "src=" http://images2015.cnblogs.com/blog/605186/ 201512/605186-20151216092405037-834711096.png "width=" 601 "height=" "style=" border:0px;padding-top:0px; Padding-left:0px;padding-right:0px;background-image:none; "/>


Make install


650) this.width=650; "Title=" image (7) "border=" 0 "alt=" image (7) "Src=" http://images2015.cnblogs.com/blog/605186/ 201512/605186-20151216092406256-834233930.png "width=" 596 "height=" "style=" border:0px;padding-top:0px; Padding-left:0px;padding-right:0px;background-image:none; "/>


In this way, the curl.so is copied to the PHP corresponding directory (e.g./usr/local/php/lib/php/extensions/no-debug-zts-20131226)

2. Modify the configuration

In php.ini, set the extension directory:

Extension_dir = "/usr/local/php/lib/php/extensions/no-debug-zts-20131226"

and add Extension reference:

Extension = curl.so

3. Check and restart Apache

/usr/local/php/bin/php-v

When executing this command, PHP will check the configuration file is correct, if there is a configuration error, here will be error, can be based on the wrong information to troubleshoot

Add:

1. When you need to install your own manually compiled expansion pack, specify the following in the EXT directory

The following is the way to install the GD library under the/ext/gd file to enable it to support FreeType

./configure--with-freetype-dir=/usr/local/freetype--with-php-config=/usr/local/php/bin/php-config

2. When installing the pdo_mysql extension

/usr/local/php/bin/phpize

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

The following error occurred after make:

650) this.width=650; "Title=" image (8) "border=" 0 "alt=" image (8) "src=" http://images2015.cnblogs.com/blog/605186/ 201512/605186-20151216092408224-891609765.png "width=" 784 "height=" "style=" border:0px;padding-top:0px; Padding-left:0px;padding-right:0px;background-image:none; "/>

It means that the 27th line of Php_pdo_mysql_int.h contains the file without finding him the mysqlnd.h he needed but actually found mysqlnd.h in Ext/mysqlnd so it's roughly his containment path. Edit Php_pdo_mysql _int.h to 27 rows to change to the following (change to direct access to the corresponding header file path)

650) this.width=650; "Title=" image (9) "border=" 0 "alt=" image (9) "src=" http://images2015.cnblogs.com/blog/605186/ 201512/605186-20151216092413131-751508369.png "width=" 786 "height=" 144 "style=" border:0px;padding-top:0px; Padding-left:0px;padding-right:0px;background-image:none; "/>


This article is from the "Dream to Reality" blog, please be sure to keep this source http://lookingdream.blog.51cto.com/5177800/1862606

PHP manually add an extension library under Linux

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.