kidys 发表于 2015-8-20 14:27:01

centos6 lamp下安装php的ssh2扩展库

  ssh2扩展的安装
yum install libssh2-devel
wgethttp://pecl.php.net/get/ssh2-0.12.tgz
tar zvxf ssh2-0.12.tgz
cdssh2-0.12
/usr/bin/phpize
./configure --with-php-config=/usr/bin/php-config
make
make install
修改php.ini添加:extension=ssh2.so
  使用ssh向服务器上传文件
  <?php
   2$connection = ssh2_connect(8.8.8.8', 22);
   3ssh2_auth_password($connection, 'root', 123456');
      
   4ssh2_scp_send($connection, '/home/wwwroot/default/ssh.php', '/home/wwwroot/default/ssh.php', 0644);
   5?>
页: [1]
查看完整版本: centos6 lamp下安装php的ssh2扩展库