Add extension method to PHP in Linux

Source: Internet
Author: User

Example

(1). Recompile PHP Again (this method will compile more things, so it is more time-consuming),

(2). To compile the FTP extension individually and then configure PHP to support the extension (this is the way to save time, so choose this way)

(1). Extract PHP Source code

Tar xvf php-5.3.5.tar.bz2

CD php-5.3.5

(2). Access to FTP extended directory compilation

CD ext/ftp

(3). Run phpize, prepare for PHP extension compilation

$PREFIX/php/bin/phpize

(4). Configure FTP extensions (Php-config is a command to obtain a PHP environment)

./configure--with-php-config= $PREFIX =/php/bin/php-config

(5). Compiling and installing

Make && make install

Description: When installed, displays the directory where the extension is installed, such as

$PREFIX/php/lib/php/extensions/no-debug-zts-20090626/

(6). Configure PHP.ini Add:

extension_dir= $PREFIX/lib/php/extensions/no-debug-zts-20090626

Extension=ftp.so

(7). Restart the Apache server to take effect

Service httpd Restart

Example hpize command is used to prepare the PHP plug-in module of the compilation environment. In the following example, the source program for the plug-in module is located in the Extname directory:

$ CD Extname

$ phpize

$/configure (note i)

$ make

$ make Install

Successful installation will be built extname.so and placed in the PHP plug-in directory (preset stored in/usr/lib/php/modules/).

You need to adjust the php.ini and join the extension=extname.so to use this plug-in module.


Compiling Add extensions

The support needed to compile PHP
Yum Install GCC
Yum install libxml2-devel curl-devel libjpeg libjpeg-devel libpng-devel freetype-devel.x86_64 mysql-devel
Yum Install freetype-devel.x86_64 freetype.x86_64
Yum Install Libjpeg Libjpeg-devel

Download Php:wget http://us1.php.net/distributions/php-5.3.28.tar.bz2

TAR-JXF php-5.3.28.tar.bz2
CD php-5.3.28

./configure–prefix=/usr/local/php-5.3.28–enable-fpm–with-mysql–with-zlib–with-config-file-path=/usr/local/php5 .3.28/etc–with-pdo-mysql–with-libdir=lib64–with-gd–with-jpeg-dir=/usr/lib–with-png-dir=/usr/lib– enable-mbstring–enable-gd-native-ttf–enable-xml–with-freetype-dir–with-curl–enable-ftp–enable-zip–with-mcrypt– Enable-mbstring–enable-json

Failure occurred

Checking for alloca ... (cached) Yes
Checking for 8-bit clean memcmp ... yes
Checking for stdarg.h ... (cached) Yes
Checking for MCrypt support ... yes
Configure:error:mcrypt.h not found. Please reinstall Libmcrypt

Rpm-qa | grep libmcrypt
Libmcrypt-2.5.7-5.el5
Libmcrypt-2.5.8-4.el5.centos

There is but failure, the above is installed with Yum, no, do not need to download the package compiled?? Give it a try:

wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/attic/libmcrypt/libmcrypt-2.5.7.tar.gz Installation:
TAR-ZXVF libmcrypt-2.5.7.tar.gz
CD libmcrypt-2.5.7
./configure
Make
make install

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.