zoukankan      html  css  js  c++  java
  • PHP5不重新编译,如何安装自带的未安装过的扩展,如soap扩展?

    来源:http://blog.snsgou.com/post-670.html

    按照如下教程:

    LAMP一键安装包-CentOS 5/6下自动编译安装Apache、MySQL、PHP

    在虚拟机的CentOS5.5中,一键安装了PHP运行环境,但发现并没有 soap 扩展,而近期项目用需要用到 webservice。

    上述的一键安装(lamp0.4),其实是源码编译安装,PHP配置文件的路径为 /etc/php.ini ,安装后,遗留的文件目录为 “/home/jianbao/2/lamp0.4”,里面的文件列表为:

    [root@localhost lamp0.4]# ll
    总计 59296
    -rw-r--r-- 1 root    root      982243 2012-05-23 apr-1.4.6.tar.gz
    -rw-r--r-- 1 root    root      774770 2012-05-23 apr-util-1.4.1.tar.gz
    drwxrwxr-x 2 jianbao jianbao     4096 2012-05-29 conf
    -rw-r--r-- 1 root    root     5616185 2012-05-23 httpd-2.4.2.tar.gz
    -rwxrwxr-x 1 jianbao jianbao    25116 2012-06-28 lamp.sh
    -rw-r--r-- 1 root    root     4984397 2012-01-21 libiconv-1.14.tar.gz
    -rw-r--r-- 1 root    root     1335178 2012-03-26 libmcrypt-2.5.8.tar.gz
    -rw-r--r-- 1 root    root      471915 2012-03-26 mcrypt-2.6.8.tar.gz
    -rw-r--r-- 1 root    root      931437 2012-03-26 mhash-0.9.9.9.tar.gz
    -rw-r--r-- 1 root    root    24518874 2012-05-10 mysql-5.5.24.tar.gz
    -rw-r--r-- 1 root    root    14913792 2012-05-10 php-5.3.13.tar.gz
    -rw-r--r-- 1 root    root     5944741 2012-05-10 phpMyAdmin-3.5.1-all-languages.tar.gz
    -rwxrwxr-x 1 jianbao jianbao     1792 2012-05-29 pureftpd.sh
    drwxr-xr-x 2 root    root        4096 06-09 21:36 untar
    -rwxrwxr-x 1 jianbao jianbao     1563 2012-02-14 xcache.sh
    -rwxrwxr-x 1 jianbao jianbao     2720 2012-06-15 zend.sh

    我选择的PHP版本为上述的 php-5.3.13.tar.gz,现在需要做的事情是:

    1、把 “php-5.3.13.tar.gz”源码压缩包拷贝的另外一个目录,如 “/home/jianbao/1”,并解压

    2、切换到解压后的 soap 源码目录:

    cd  /home/jianbao/1/php-5.3.13/ext/soap

    3、运行 phpize 命令:

    [jianbao@localhost soap]$ /usr/local/php/bin/phpize
    Configuring for:
    PHP Api Version:         20090626
    Zend Module Api No:      20090626
    Zend Extension Api No:   220090626

    这时,会在当前目录生成 configure 等文件。

    [jianbao@localhost soap]$ ./configure --with-php-config=/usr/local/php/bin/php-config --enable-soap
    checking for egrep... grep -E
    checking for a sed that does not truncate output... /bin/sed
    checking for cc... cc
    checking for C compiler default output file name... a.out
    checking whether the C compiler works... yes
    checking whether we are cross compiling... no
    checking for suffix of executables...
    checking for suffix of object files... o
    ...
    ...
    ...
    checking if libtool supports shared libraries... yes
    checking whether to build shared libraries... yes
    checking whether to build static libraries... no
    
    creating libtool
    appending configuration tag "CXX" to libtool
    configure: creating ./config.status
    config.status: creating config.h

    5、运行 make 命令:

    [jianbao@localhost soap]$ make
    /bin/sh /home/jianbao/1/php-5.3.13/ext/soap/libtool --mode=compile cc  -I. -I/home/jianbao/1/php-5.3.13/ext/soap -DPHP_ATOM_INC ......

    6、运行 make  install 命令:

    注意,会出现权限问题,临时切换到 root 用户即可。

    [jianbao@localhost soap]$ su
    口令:
    [root@localhost soap]# make install
    Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/
    [root@localhost soap]# ll /usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/
    总计 832
    -rwxr-xr-x 1 root root 840501 06-10 01:09 soap.so
    [root@localhost soap]#

    安装好之后会提示 soap.so 文件的保存路径

    7、修改 /etc/php.ini 文件:

    找到 extension_dir="./",默认是注释掉的,

    修改为 extension_dir="/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/" 

    并在此行后增加如下配置:

    extension=soap.so

    然后保存。

    8、重启 Apache:

    [root@localhost jianbao]# /etc/init.d/httpd restart
    停止 httpd:                                               [确定]
    启动 httpd:                                               [确定]

    9、查看扩展是否已加载

    [root@localhost jianbao]# /usr/local/php/bin/php -m
    [PHP Modules]
    Core
    ctype
    curl
    date
    dom
    ereg
    fileinfo
    filter
    ftp
    gd
    hash
    iconv
    json
    libxml
    mbstring
    mcrypt
    mysql
    openssl
    pcre
    PDO
    pdo_sqlite
    Phar
    posix
    Reflection
    session
    SimpleXML
    soap
    SPL
    SQLite
    sqlite3
    standard
    tokenizer
    xml
    xmlreader
    xmlwriter
    zip
    zlib
    
    [Zend Modules]

    soap 已在里面啦,安装成功!!!

    今后,要安装其他的扩展,同理可得。

  • 相关阅读:
    NET領域模型(1)
    oracle 函數索引(1)
    oracle 動態SQL(1)
    WF事件驱动(5)
    WF事件驱动(3)
    WF事件驱动(4)
    HP LoadRunner 11.00 新鲜尝
    Tomcat配置优化要点
    WebSphere性能诊断与调优
    性能测试工具、监控工具
  • 原文地址:https://www.cnblogs.com/wkpilu/p/3536868.html
Copyright © 2011-2022 走看看