PHP动态扩展模块

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP动态扩展模块相关的知识,希望对你有一定的参考价值。

php动态扩展模块

  • /usr/local/php/bin/php -m //查看模块
  • 下面安装一个redis的模块
    • cd /usr/local/src/
    • wget https://codeload.github.com/phpredis/phpredis/zip/develop
    • mv develop phpredis-develop.zip
    • unzip phpredis-develop.zip
    • cd phpredis-develop
    • /usr/local/php/bin/phpize //生成configure文件
      [[email protected] phpredis-develop]# /usr/local/php7/bin/phpize 
      Configuring for:
      PHP Api Version:         20160303
      Zend Module Api No:      20160303
      Zend Extension Api No:   320160303
      Cannot find autoconf. Please check your autoconf installation and the
      $PHP_AUTOCONF environment variable. Then, rerun this script.
      [[email protected] phpredis-develop]# yum install -y autoconf
      [[email protected] phpredis-develop]# /usr/local/php7/bin/phpize 
      Configuring for:
      PHP Api Version:         20160303
      Zend Module Api No:      20160303
      Zend Extension Api No:   320160303
      [[email protected] phpredis-develop]# ls
      acinclude.m4       configure          Makefile.global     redis_cluster.c
      aclocal.m4         configure.in       missing             redis_cluster.h
      arrays.markdown    config.w32         mkdeb-apache2.sh    redis_commands.c
      autom4te.cache     COPYING            mkdeb.sh            redis_commands.h
      build              crc16.h            mkinstalldirs       redis_session.c
      cluster_library.c  CREDITS            package.xml         redis_session.h
      cluster_library.h  debian             php_redis.h         rpm
      cluster.markdown   debian.control     README.markdown     run-tests.php
      common.h           install-sh         redis_array.c       serialize.list
      config.guess       ISSUE_TEMPLATE.md  redis_array.h       tests
      config.h.in        library.c          redis_array_impl.c
      config.m4          library.h          redis_array_impl.h
      config.sub         ltmain.sh          redis.c
      [[email protected] phpredis-develop]# 
    • ./configure --with-php-config=/usr/local/php/bin/php-config
    • make && makeinstall
    • /usr/local/php7/bin/php -i |grep extension_dir //查看扩展模块存放目录,我们可以在php.ini中去自定义该路径
    • vim /usr/local/php7/etc/php.ini //增加一行配置(可以放到文件最后一行)
      extension = redis.so
      ;extension=php_xsl.dll
      extension=redis.so
    • /usr/local/php7/bin/php -m |grep redis
  • 在PHP的源码包中没有第三方模块的包,但是在PHP源码包的/ext/目录下有好多扩展模块,如果所需要的扩展模块在该目录下,可以直接进行安装不用下载
    [email protected] ~]# cd /usr/local/src/php-7.1.6/ext/
    [[email protected] ext]# ls
    bcmath              fileinfo   libxml     pdo_firebird  session    tidy
    bz2                 filter     mbstring   pdo_mysql     shmop      tokenizer
    calendar            ftp        mcrypt     pdo_oci       simplexml  wddx
    com_dotnet          gd         mysqli     pdo_odbc      skeleton   xml
    ctype               gettext    mysqlnd    pdo_pgsql     snmp       xmlreader
    curl                gmp        oci8       pdo_sqlite    soap       xmlrpc
    date                hash       odbc       pgsql         sockets    xmlwriter
    dba                 iconv      opcache    phar          spl        xsl
    dom                 imap       openssl    posix         sqlite3    zip
    enchant             interbase  pcntl      pspell        standard   zlib
    exif                intl       pcre       readline      sysvmsg
    ext_skel            json       pdo        recode        sysvsem
    ext_skel_win32.php  ldap       pdo_dblib  reflection    sysvshm

    扩展

  • apache rewrite教程(http://www.cnblogs.com/top5/archive/2009/08/12/1544098.html)
  • apache rewrite 出现死循环
  • php错误日志级别参考
  • php开启短标签
  • php.ini详解

以上是关于PHP动态扩展模块的主要内容,如果未能解决你的问题,请参考以下文章

php编译后动态扩展模块

PHP扩展模块安装

LAMP架构-PHP动态扩展模块

88.PHP扩展模块安装

LAMP-php动态扩展模块安装

php动态扩展模块