9_php扩展模块的安装
admin
2023-06-21 14:22:23
0次

在此处楼主遇到一个问题,用命令查看,居然不出现php 的模块。

[root@OBird ~]# /usr/local/php/bin/php -m

于是进行到目录下这样操作,才出现,望解:

[root@OBird ~]# cd /usr/local/php/bin

[root@OBird bin]# ls

pear  peardev  pecl  phar  phar.phar  php  php-cgi  php-config  phpdbg  phpize

[root@OBird bin]# php -m

[PHP Modules]  # 此时静态或动态文件是看不出来的。动态的是可以在 php.ini 里面去定义。

Core

ctype

date

dom

ereg

fileinfo

filter

hash

iconv

json

libxml

mysqli

pcre

PDO

pdo_sqlite

Phar

posix

Reflection

session

SimpleXML

SPL

sqlite3

standard

tokenizer

xml

xmlreader

xmlwriter


[Zend Modules]


有时候我们会发现有些模块没有编译进来,有两种办法,一是找到源码包重编译。二使用动态的方式来加载。类似于apache 的动态共享模块。

下面我们就来用第二种方法,编译一个动态的共享模块。

[root@OBird ~]# cd /usr/local/src/php-5.6.24  #进到php 的源码包

[root@OBird php-5.6.24]# ls

acinclude.m4      generated_lists     Makefile.global      README.MAILINGLIST_RULES          server-tests-config.php

aclocal.m4        genfiles            Makefile.objects     README.md                         server-tests.php

build             header              makerpm              README.namespaces                 snapshot

buildconf         include             missing              README.NEW-OUTPUT-API             stamp-h.in

buildconf.bat     INSTALL             mkinstalldirs        README.PARAMETER_PARSING_API      stub.c

CODING_STANDARDS  install-sh          modules              README.REDIST.BINS                tests

config.guess      libphp5.la          netware              README.RELEASE_PROCESS            travis

config.log        libs                NEWS                 README.SELF-CONTAINED-EXTENSIONS  TSRM

config.nice       libtool             pear                 README.STREAMS                    UPGRADING

config.status     LICENSE             php5.spec            README.SUBMITTING_PATCH           UPGRADING.INTERNALS

config.sub        ltmain.sh           php5.spec.in         README.TESTING                    vcsclean

configure         main                php.gif              README.TESTING2                   win32

configure.in      makedist            php.ini-development  README.UNIX-BUILD-SYSTEM          Zend

CREDITS           Makefile            php.ini-production   README.WIN32-BUILD-SYSTEM

ext               Makefile.frag       README.EXT_SKEL      run-tests.php

EXTENSIONS        Makefile.fragments  README.GIT-RULES     sapi

footer            Makefile.gcov       README.input_filter  scripts


[root@OBird php-5.6.24]# cd ext/  # php 所有的块都在这个目录下

[root@OBird ext]# ls

bcmath      dom                 ftp        intl      mysqli   pdo           pgsql       shmop      standard   xml

bz2         enchant             gd         json      mysqlnd  pdo_dblib     phar        simplexml  sybase_ct  xmlreader

calendar    ereg                gettext    ldap      oci8     pdo_firebird  posix       skeleton   sysvmsg    xmlrpc

com_dotnet  exif                gmp        libxml    odbc     pdo_mysql     pspell      snmp       sysvsem    xmlwriter

ctype       ext_skel            hash       mbstring  opcache  pdo_oci       readline    soap       sysvshm    xsl

curl        ext_skel_win32.php  iconv      mcrypt    openssl  pdo_odbc      recode      sockets    tidy       zip

date        fileinfo            imap       mssql     pcntl    pdo_pgsql     reflection  spl        tokenizer  zlib

dba         filter              interbase  mysql     pcre     pdo_sqlite    session     sqlite3    wddx


以 curl 为例进行编译:

[root@OBird ext]# /usr/local/php/bin/php -m |grep -i curl

[root@OBird ext]# cd curl/

[root@OBird curl]# ls

config.m4  config.w32  CREDITS  curl.dsp  curl_file.c  interface.c  multi.c  package.xml  php_curl.h  share.c  tests

[root@OBird curl]# /usr/l

lib/     lib64/   libexec/ local/   

[root@OBird curl]# /usr/local/php/bin/phpize   #生成configure 文件

Configuring for:

PHP Api Version:         20131106

Zend Module Api No:      20131226

Zend Extension Api No:   220131226

[root@OBird curl]# ls

acinclude.m4    build         config.m4   configure.in  curl.dsp     interface.c      missing        package.xml    share.c

aclocal.m4      config.guess  config.sub  config.w32    curl_file.c  ltmain.sh        mkinstalldirs  php_curl.h     tests

autom4te.cache  config.h.in   configure   CREDITS       install-sh   Makefile.global  multi.c        run-tests.php

[root@OBird curl]# ./configure --with-php-config=/usr/local/php/bin/php-config

———————————————————————————————————————————————

楼主在编译的过程中出现了报错,那么就停下解决问题


configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.


[root@OBird curl]# cd /usr/local/src/


[root@OBird src]# wget https://github.com/skvadrik/re2c/releases/download/0.13.6/re2c-0.13.6.tar.gz

# tar xf re2c 0.13.4.tar.gz

# cd re2c 0.13.4

# ./configure

#make && make install

后面还是出错

checking for cURL in default path... not found

configure: error: Please reinstall the libcurl distribution -

    easy.h should be in /include/curl/

在网上找到了解决办法

php安装错误configure: error: Please reinstall the libcurl distribu

今天配置一台server的php支持curl的时候, 出现如下报错

checking for cURL in default path... not found
configure: error: Please reinstall the libcurl distribution -
easy.h should be in /include/curl/

其实就是curl的dev包没有安装, 解决方案:
终端下

# yum -y install curl-devel

然后就可以继续了

排错到此结束,继续

———————————————————————————————————————————————

[root@OBird curl]# make install  #/curl.so 模块文件会被放在下面这个目录


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


[root@OBird curl]# ls /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/curl.so 

/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/curl.so


extension_dir 是存放扩展模块的。  也是可以自定义的。

[root@OBird curl]# cd /usr/local/php/bin/

[root@OBird bin]# php -i |grep extension_dir

extension_dir => /usr/local/lib/php/extensions/no-debug-non-zts-20131226 => /usr/local/lib/php/extensions/no-debug-non-zts-20131226

sqlite3.extension_dir => no value => no value


[root@OBird ~]# cd /usr/local/php/bin

[root@OBird bin]# php -m  # 此时是查看不到curl 这个模块的。刚才在php.ini文件将模块名写错

来做测试 “curl1.so"

[root@OBird bin]# tail /usr/local/php/logs/php_errors.log 

[02-Oct-2016 09:00:31 UTC] PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/curl1.so' - /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/curl1.so: cannot open shared object file: No such file or directory in Unknown on line 0


[root@OBird bin]# vim /usr/local/php/etc/php.ini 

extension=curl1.so # 修正


正常再重新加载就可以看到 curl这个模块,但是楼主不知是哪里出错了,这个效果没有做出来,但是curl 这个命令可以正常使用。只能先跳过去 了。

相关内容

热门资讯

空调连续工作多久需要停机休息 空调连续工作的时间取决于多个因素,包括空调的型号、功率、使用环境和维护情况等。一般来说,空调可以连续...
空调哪个符号是除湿的 空调除湿功能通常用一个水滴形状的符号表示。不同品牌和型号的空调遥控器可能会有所差异,但一般来说,除湿...
格力空调多长时间加一次氟利昂 1、一般情况下,空调对氟利昂的使用量是非常小的,所以在空调使用了四年左右的时候再考虑加也没问题。2、...
空调用多长时间需要加氟一次 一般情况下是五年。当出现以下这几种情况时,空调才需要加氟。1、空调的室内机和室外机各有两个接口,当接...
格调生活·C标思享荟:卡萨帝在... 9月12日的郑州龙湖金融岛,夜风轻拂,灯光璀璨。“C标时刻共传奇——卡萨帝思享荟暨20周年品牌盛典郑...
品牌价值破千亿、高端份额持续领... 9月12日,“C标时刻共传奇——卡萨帝思享荟暨20周年品牌盛典郑州站”在郑州龙湖金融岛举办。2026...
空调主板坏了修800还是换新的 空调主板坏了是修还是换新,需要考虑多个因素,以下是一些建议:1. 维修成本:如果维修费用较低,比如 ...
空调开多久需要休息多长时间 问题:空调开多久需要休息多长时间回答:1、在使用空调的过程中,一般空调开7~8个小时左右需要休息2~...
中央空调多长时间清洗一次 1、一般空调开机前清洗一次即可,空调开机中间时段再清洗一次,空调关机时清洗一次,这样比较合理。2、空...
中央空调氟利昂多久加一次 看空调制热和制冷程度,很多人的观点认为氟利昂必须一年放一次,其实这个观点是错误的,理解上面有点偏差,...