北极星光 发表于 2018-12-21 08:22:30

PHP的SSH2扩展的安装

  PHP的SSH2扩展的安装(基于linux(centos))
  要在php里面用到ssh
  首先要确保系统已经安装好了(LNMP或者LAMP,具体的安装方式见地址
  系统环境 centos 5.6x64
  # uname -a
  Linux localhost 2.6.18-238.el5 #1 SMP Thu Jan 13 15:51:15 EST 2011 x86_64 x86_64 x86_64 GNU/Linux
  前提环境:yum install php
  1.安装OpenSSL
  # yum install openssl
  # yum install openssl-devel
  2. 编译安装libssh2
  wget http://www.libssh2.org/download/libssh2-1.2.9.tar.gz
  tar zxvf libssh2-1.2.9.tar.gz
  cd libssh2-1.2.9
  ./configure&&make&&make install
  3. 编译安装ssh2(官网http://www.php.net/ssh2)
  wget http://pecl.php.net/get/ssh2-0.11.2.tgz
  tar zxvf ssh2-0.11.2.tgz
  cd ssh2-0.11.2
  phpize(如果没有找到该命令,请确定是否安装的是php-dev)
  ./configure --with-ssh2
  make
  cp modules/ssh2.so /usr/lib64/php/modules/
  echo "extension=ssh2.so" >> /etc/php.ini
  4. 重启httpd
  service httpd restart

页: [1]
查看完整版本: PHP的SSH2扩展的安装