Dynamic installation of PHP module extensions (no need to reload PHP) - with phpize

=

=

=

Basic installation method:

# wget http://pecl.php.net/get/redis-3.1.2.tgz
# tar zxvf redis-3.1.2.tgz
# cd redis-3.1.2
# phpize
# ./configure
# make && make install

修改/usr/local/php/etc/php.ini
extension_dir = "/usr/lib64/php/modules/"
extension=redis.so

Then configure the extension.

 

Configuration extensions and examples

General extensions are contained in the ext directory of the php source code, such as the ldap module, the ldap directory in the ext directory of the phpN.N source code.

1. Install ldap

# cd ext/ldap/
# phpize
# ./configure --with-php-config=/usr/bin/php-config --with-ldap
# make  && make install 

 

2. PHP loads the ldap extension

extension_dir = "/usr/lib64/php/modules/"
extension=ldap.so

 

3. You may need to restart the environment

/etc/init.d/php-fpm restart

/usr/local/nginx/sbin/nginx -s reload

 

4. You may need to specify the source directory.

Although phpize is the current directory by default, there are so many versions of php that it is really not standard and messy.

Sometimes you need to specify the source directory, such as specifying the current directory:

--with-ldap=/root/june/lnmp1.4/src/php-5.5.38/ext/ldap

This way you won't have to go around looking for source code by default.

 

5. Some versions may need to specify whether the dependency is x86 or x64-bit

For example, add this parameter: --with-libdir=lib64, so that you don't have to look for 32-bit packages.

 

Special: If it is an environment installed by lnmp or lnmpa, dynamically install the PHP module extension (no need to reinstall PHP) - use phpize

As long as the source code is found, the rest is the same as the above method.

The source code is in the src directory of lnmp. May need to be decompressed.

 

Error 1: --with-php-config

一般这个参数可以不用加,默认就可以run,但如果某些版本找不到这个参数,则需要手动指定。

一般的这个配置都是--with-php-config=/usr/local/php/bin/php-config

但有时候自己安装的php在别的目录,则需要修改一下。

自己找找php的bin目录。

 

报错1:报错了,config.log 让看这个log

 可以看看里面的错误记录,找到报错的行和原因,查一下就好了。

 

 

 

 

=

=

=

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326059484&siteId=291194637