"Turn" phpize study

Source: Internet
Author: User
Tags configuration php

Why use Phpize?

For example, when you first start the installation, use

./configure--PREFIX=/USR/LOCAL/PHP7--EXEC-PREFIX=/USR/LOCAL/PHP7--bindir=/usr/local/php7/bin--sbindir=/usr/ Local/php7/sbin--includedir=/usr/local/php7/include--libdir=/usr/local/php7/lib/php--mandir=/usr/local/php7/ Php/man--with-config-file-path=/usr/local/php7/etc--with-mysql-sock=/var/run/mysql/mysql.sock--with-mcrypt=/ Usr/include--with-mhash--with-openssl--with-mysql=shared,mysqlnd--with-mysqli=shared,mysqlnd--with-pdo-mysql= Shared,mysqlnd--with-gd--with-iconv--with-zlib--enable-zip--enable-inline-optimization--disable-debug-- Disable-rpath--enable-shared--enable-xml--enable-bcmath--enable-shmop--enable-sysvsem--enable-mbregex-- Enable-mbstring--enable-ftp--enable-gd-native-ttf--enable-pcntl--enable-sockets--with-xmlrpc--enable-soap-- Without-pear--with-gettext--enable-session--with-curl--with-jpeg-dir--with-freetype-dir--enable-opcache-- ENABLE-FPM--enable-fastcgi--with-fpm-user=nginx--with-fpm-group=nginx--without-gdbm--disable-fileinfo

One day you need to use the new extension, you need to reinstall, but if you recompile the entire source code, it is too much trouble; Phpize is the answer to the whole problem.

First into the/home/jack/php-7.0.6/ext source extension directory

Then execute:

CD Standard

./configure

Make

Make install

Compiling shared PECL extensions with Phpize

Sometimes, using the PECL installer is not a option. This could being because you ' re behind a firewall, or it could being because the extension you want to install are not available As a PECL compatible package, such as unreleased extensions from SVN. If you need to build such a extension, you can use the Lower-level build tools to perform the build manually.

The Phpize command is used to prepare, the build environment for a PHP extension. In the following sample, the sources for an extension is in a directory named Extname:

$ cd extname into the extension directory in the source package(that is, you download the PHP source package/home/jack/php-7.0.6/ext), this extension directory, popular understanding, if you want to install the operation of the GD library, then downloaded to the source of the library, decompression source will have a directory, into this directory.
$ phpize Run phpize. The path is not necessarily in this directory, but is generally in the installation directory (as I understand, each phpize is related to the specific version, it is not possible to generic), to find Phpize run. A configure file is then generated
$./configure run. If you build a database-based extension, you need to add parameters to run: 1,--with-php-config. 2, "--with-Specific database Parameters". For example,--with-pgsql 、--with-mysql
$ make
# make install will generate a extname.so extension that is placed in the PHP extensions directory


A successful install'll has created extname.so and put it into the PHP extensions directory ( generates a. So file that is automatically put into PHP's Expand the directory down, I think it should be phpize can automatically detect the location of the PHP extension directory ).

You'll need to and adjust php.ini and add a extension=extname.so line before your can use the extension.

If The system is missing the Phpize command, and precompiled packages (like RPM's) are used, being sure to also install the A Ppropriate devel version of the PHP package as they often include the phpize command along with the appropriate header fil Es to build PHP and its extensions.

Execute phpize--help to display additional usage information.


The role of phpize can be understood as follows: the detection environment (Phpize tool is in the PHP installation directory, based on this phpize corresponding to the PHP environment at the time, so it is based on the configuration of the PHP to generate the corresponding configure file), the establishment of a configure file. You must run Phpize in a directory. Then phpize know which directory your environment is, and configure files are built into that directory.

Summary of steps:

One, cd/usr/src/php source package directory/ext/Extension Directory/

Second,/usr/local/php5314/bin/phpize


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

D && make install

Ps:make install automatically copies the generated. so extension to the PHP extension directory, such as prompting for installation to/usr/local/php/php-5.5.18/lib/php/extensions/ no-debug-non-zts-20121212/directory Down
Five, the rest is the configuration php.ini




If you have multiple versions of PHP installed on your server, you need to tell phpize which version of the extension to build on. Specify which PHP version you use by using--with-php-config=.

For example:--with-php-config=/usr/local/php524/bin/php-config

About the Php-config file: It is a file that is placed in the installation directory after the PHP build (installed). Opening the contents of the Phpize file will reveal that variables such as PHP's installation directory are defined.

prefix= '/usr/local/php '

Phpize is generated when the installation is compiled and records some of the information that was installed at that time. It is not possible to take a phpize from anywhere else.

Phpize is a file in the PHP installation directory. For example, if I install two php5.2 and php5.3 then use Phpize to use the corresponding version of Phpize . What is the purpose of using--with-php-config at this time?

Where is the Phpize tool generally?

When PHP is compiled, thephpize script file will be available in the bin directory under the PHP installation directory . So it is to install the PHP installation directory to find.

"Turn" phpize study

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.