GVKun编程网logo

PHP扩展安装方法步骤解析(php扩展安装方法步骤解析)

11

如果您对PHP扩展安装方法步骤解析感兴趣,那么本文将是一篇不错的选择,我们将为您详在本文中,您将会了解到关于PHP扩展安装方法步骤解析的详细内容,我们还将为您解答php扩展安装方法步骤解析的相关问题,

如果您对PHP扩展安装方法步骤解析感兴趣,那么本文将是一篇不错的选择,我们将为您详在本文中,您将会了解到关于PHP扩展安装方法步骤解析的详细内容,我们还将为您解答php扩展安装方法步骤解析的相关问题,并且为您提供关于CentOS yum php mcrypt 扩展安装方法、CentOS下PHP的SSH2扩展安装方法、ffmpeg - php扩展安装问题:本地两个php,安装php 扩展老是安装不上、GeoIP PHP扩展安装与配置的有价值信息。

本文目录一览:

PHP扩展安装方法步骤解析(php扩展安装方法步骤解析)

PHP扩展安装方法步骤解析(php扩展安装方法步骤解析)

php扩展安装方法极简单. 也遵循3大步.但多出一个phpize的步骤.

1.pecl.php.net 在右上解的输入框 中输入需要的扩展 比如 redis

2.搜索完成后会看到两个蓝色的框 . 下方有个表格. 表格内容如 search results (1 of 1) 再下面有一行不起眼的结果. 其中就有一个redis(搜索什么显示什么)关键词.然后点击进入一个界面

3.这个界面中,是一个表格. 其中最底步的表格中 有各版本的说明. 并不是任意版本支持所有php版本号. 都是有对应的. 都在这个表格中有说明. 看不懂的可以拿翻译工具.

4.下载下来对应的版本. 到linux中. 从第5步开始就是安装步骤了.

5.解压到任意目录 (此时,没有configure文件),进入redis源码目录(该目录下有个叫config.m4的文件),输入phpize(如果提示不存在可以使用绝对路径,比如/usr/local/php/bin/phpize) 它位于php安装路径下的bin目录
会出现以下代码

Configuring for:
PHP Api Version: 20131106
Zend Module Api No: 20131226
Zend Extension Api No: 220131226

6. 此时再看.会出现configure等若干个文件.不需要管别的. 直接configure 此时不需要指定路径.但需要指定php-config路径(如果您对php-config做过环境变量,也就是输入php-config命令没提示命令找不到则不需要指定)

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

7.执行make && make install 安装完成

Installing shared extensions: /usr/local/php-5.6.23/lib/php/extensions/no-debug-non-zts-20131226/

说明安装完成了. 可以看到,安装路径是在php目录下.接下来去php.ini搜索;extension 可以看到类似以下代码的

;extension=php_curl.dll
;extension=php_fileinfo.dll
;extension=php_gd2.dll
;extension=php_gettext.dll
;extension=php_gmp.dll

然后复制一行输入 如下(第一行)

extension=redis.so
;extension=php_bz2.dll
;extension=php_curl.dll
;extension=php_fileinfo.dll
;extension=php_gd2.dll
;extension=php_gettext.dll
;extension=php_gmp.dll

最后一步,重启php-fpm 比如

service php56 restart
#或
service php70 restart

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。

您可能感兴趣的文章:
  • PHP的命令行扩展Readline相关函数的使用
  • PHP的runkit扩展如何使用
  • PHP缓存系统APCu扩展的使用
  • 如何动态查看及加载PHP扩展
  • Thinkphp使用Zxing扩展库解析二维码内容图文讲解
  • PHP 扩展Memcached命令用法实例总结
  • PHP扩展类型及安装方式解析
  • 如何使用Zephir轻松构建PHP扩展

CentOS yum php mcrypt 扩展安装方法

CentOS yum php mcrypt 扩展安装方法

使用 yum install PHP-mcrypt 安装mcrypt扩展时会提示没有安装包

Setting up Install Process

No package PHP-mcrypt available.

Error: nothing to do

mcrypt 是加密扩展库,加载了它可以用他里面自带的22种加密解密算法

CentOS6 默认安装的是PHP5.3.2

默认的 redhat repos PHP中是没有 mcrypt 扩展的

根据红帽的官方消息(https://bugzilla.redhat.com/show_bug.cgi?id=621268)RHEL 不打算添加PHP的mcrypt 的支持

Joe Orton 2010-08-05 04:47:17 EDT

Thanks for the report.

We are not planning to ship mcrypt support for PHP.

 解决方法:

从PHP 官网下载新的PHP 5.3 源码包后,解压到本地目录

进入解压目录下的 ext 目录后会发现有 mcrypt ,

进入 mcrypt 目录

#cd /ext/mcrypt

#PHPize

注意:如果报 -bash:PHPize not Found  那么 yum install PHP-devel 就可以使PHPize进行动态编译安装扩展

#./configure  -with-PHP-config=/usr/sbin/PHP/bin/PHP-config

#make && make install

出现:

———————————————————————-

Libraries have been installed in:

   /var/PHP-5.3.10/ext/mcrypt/modules

If you ever happen to want to link against installed libraries

in a given directory,LIBDIR,you must either use libtool,and

specify the full pathname of the library,or use the `-LLIBDIR’

flag during linking and do at least one of the following:

   – add LIBDIR to the `LD_LIBRARY_PATH’ environment variable

     during execution

   – add LIBDIR to the `LD_RUN_PATH’ environment variable

     during linking

   – use the `-Wl,-rpath -Wl,LIBDIR’ linker flag

   – have your system administrator add LIBDIR to `/etc/ld.so.conf’

See any operating system documentation about shared libraries for

more information,such as the ld(1) and ld.so(8) manual pages.

———————————————————————-

Build complete.

Don’t forget to run ‘make test’.

Installing shared extensions:     /usr/lib64/PHP/modules/

查看:

# PHP -m

libxml

mbstring

mcrypt

MysqL

[Zend Modules]

已安装成功!

再次查看 PHPinfo ,可以看到mcrypt 扩展详情。

CentOS下PHP的SSH2扩展安装方法

CentOS下PHP的SSH2扩展安装方法

下载地址

wget http://www.libssh2.org/download/libssh2-1.4.2.tar.gz
wget http://pecl.PHP.net/get/ssh2-0.12.tgz

先安装 libssh2 在安装 SS2

# tar -zxvf libssh2-1.4.2.tar.gz
# cd libssh2-1.4.2
# ./configure --prefix=/usr/local/libssh2
# make && make install

以上为安装libssh2,这里需要记住libssh2的安装目录,因为在安装ssh2的时候还会用到。

# tar -zxvf ssh2-0.12.tgz
# cd ssh2-0.12
# PHPize
# ./configure --prefix=/usr/local/ssh2 --with-ssh2=/usr/local/libssh2
# make

SSH安装

# tar -zxvf ssh2-0.12.tgz
# cd ssh2-0.12
# PHPize
# ./configure --prefix=/usr/local/ssh2 --with-ssh2=/usr/local/libssh2 --with-PHP-config=/usr/local/PHP/bin/PHP-config
# make && make install

安装完成之后SSH2扩展在 /usr/local/PHP/lib/PHP/extensions/no-debug-non-zts-20121212/ 目录中
修改PHP.ini文件加入

extension=ssh2.so

啊哈哈加入扩展成功

<?PHP
$user="root";//远程用户名
$pass="123456";//远程密码
$connection=ssh2_connect('192.168.1.46',22);
ssh2_auth_password($connection,$user,$pass);
$cmd="psaux";//命令 $ret=ssh2_exec($connection,$cmd); stream_set_blocking($ret,true); echo (stream_get_contents($ret));//print_r(PHPinfo());?>

ffmpeg - php扩展安装问题:本地两个php,安装php 扩展老是安装不上

ffmpeg - php扩展安装问题:本地两个php,安装php 扩展老是安装不上

如题,
每次安装都安装不上
mac上的,用得xampp,
安装过ffmpeg和imagick扩展都不成功

回复内容:

如题,
每次安装都安装不上
mac上的,用得xampp,
安装过ffmpeg和imagick扩展都不成功

试试用制定版本绝对路径的phpize做编译配置生成,描述不是很清楚,没有贴报错或者细节一点的描述,只能提醒到这里了。

请说清楚环境 与你要装的扩展

mac上还用xampp...咋想的
用homebrew啊!装多少个版本php都没问题,安装扩展一条命令解决,用mac还要用集成环境,意义何在...
哪怕你用源码安装啊,用phpize帮助安装。另外,ffmpeg不是扩展吧,直接用绿色包就行了。
ffmpeg - php扩展安装问题:本地两个php,安装php 扩展老是安装不上

立即学习“PHP免费学习笔记(深入)”;

GeoIP PHP扩展安装与配置

GeoIP PHP扩展安装与配置

  作者:zhanhailiang 日期:2014-12-08
登录后复制

1. 安装依赖geoip-devel,geoip

GeoIP-devel.x86_64 : Development headers and libraries for GeoIPGeoIP.x86_64 : Library for country/city/organization to IP address or hostname mapping
登录后复制
yum install GeoIP.x86_64 GeoIP-devel.x86_64
登录后复制

2. 配置IP数据库GeoIP.dat,GeoLiteCity.dat

wget -N http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gzgunzip GeoIP.dat.gzmv GeoIP.dat /usr/local/share/GeoIP/
登录后复制
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gzgunzip GeoLiteCity.dat.gzmkdir -v /usr/share/GeoIPmv -v GeoLiteCity.dat /usr/share/GeoIP/GeoIPCity.dat
登录后复制
说明 :GeoIPRegion.dat是付费服务;
登录后复制

参考:

  • http://dev.maxmind.com/geoip/legacy/install/country/

  • http://forum.directadmin.com/showthread.php?t=43309

  • 3. 安装扩展

    git clone git@github.com:billfeller/geoip.git; phpize./configure --with-php-config=/usr/local/php/bin/php-config --with-geoipmake && make install
    登录后复制

    4. 测试

    立即学习“PHP免费学习笔记(深入)”;

    [root@~/wade/pecllearning/geoip]# /usr/local/php/bin/php -r ''print geoip_country_code3_by_name("220.181.112.244").PHP_EOL;''CHN[root@~/wade/pecllearning/geoip]# /usr/local/php/bin/php -r ''print_r(geoip_record_by_name("php.net"));''Array(    [continent_code] => NA    [country_code] => US    [country_code3] => USA    [country_name] => United States    [region] => CA    [city] => Fremont    [postal_code] => 94539    [latitude] => 37.51549911499    [longitude] => -121.8962020874    [dma_code] => 807    [area_code] => 510)
    登录后复制

    注意,由于本地无GeoIPRegion.dat,调用 geoip_region_by_name 时会报Warning,如下

    [root@~/wade/pecllearning/geoip]# /usr/local/php/bin/php -r ''print geoip_region_by_name("220.181.112.244");''PHP Warning:  geoip_region_by_name(): Required database not available at /usr/share/GeoIP/GeoIPRegion.dat. in Command line code on line 1 Warning: geoip_region_by_name(): Required database not available at /usr/share/GeoIP/GeoIPRegion.dat. in Command line code on line 1
    登录后复制

    今天关于PHP扩展安装方法步骤解析php扩展安装方法步骤解析的介绍到此结束,谢谢您的阅读,有关CentOS yum php mcrypt 扩展安装方法、CentOS下PHP的SSH2扩展安装方法、ffmpeg - php扩展安装问题:本地两个php,安装php 扩展老是安装不上、GeoIP PHP扩展安装与配置等更多相关知识的信息可以在本站进行查询。

    本文标签: