>백엔드 개발 >PHP 튜토리얼 >php中的Fatal error: Call to undefined function ssh2_connect()有关问题!

php中的Fatal error: Call to undefined function ssh2_connect()有关问题!

WBOY
WBOY원래의
2016-06-13 10:06:271098검색

php中的Fatal error: Call to undefined function ssh2_connect()问题!!!
在win7下架起了mysql+apache+php环境,现在想要用php通过ssh在远端服务器上执行命令,参考网上教程在php.ini内加入extension=php_ssh2.dll, 并将php_ssh2.dll放入ext,extension_dir配置没问题,但就是报错:Fatal error: Call to undefined function ssh2_connect() in D:\phpweb\ssh2\ssh.php on line 2 望各位高手指点一二。

php.ini中的扩展部分:
;extension=php_bz2.dll
extension=php_curl.dll
extension=php_dba.dll
extension=php_dbase.dll
;extension=php_exif.dll
;extension=php_fdf.dll
extension=php_gd2.dll
;extension=php_gettext.dll
;extension=php_gmp.dll
;extension=php_ifx.dll
;extension=php_imap.dll
;extension=php_interbase.dll
extension=php_ldap.dll
;extension=php_mbstring.dll
;extension=php_mcrypt.dll
extension=php_mhash.dll
extension=php_mime_magic.dll
extension=php_ming.dll
extension=php_msql.dll
extension=php_mssql.dll
extension=php_mysql.dll
extension=php_mysqli.dll
;extension=php_oci8.dll
extension=php_openssl.dll
;extension=php_pdo.dll
;extension=php_pdo_firebird.dll
extension=php_pdo_mssql.dll
extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_oci8.dll
;extension=php_pdo_odbc.dll
;extension=php_pdo_pgsql.dll
;extension=php_pdo_sqlite.dll
extension=php_pgsql.dll
;extension=php_pspell.dll
extension=php_shmop.dll
;extension=php_snmp.dll
;extension=php_soap.dll
extension=php_sockets.dll
;extension=php_sqlite.dll
;extension=php_sybase_ct.dll
extension=php_tidy.dll
extension=php_xmlrpc.dll
extension=php_xsl.dll
;extension=php_zip.dll
extension=php_ssh2.dll

php代码如下:

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><?php $connection = ssh2_connect('shell.example.com', 22);ssh2_auth_password($connection, 'username', 'password');$stream = ssh2_exec($connection, '/usr/local/bin/php -i');?>


------解决方案--------------------
你的host是否配置 shell.example.com这个域名
------解决方案--------------------
探讨

你的host是否配置 shell.example.com这个域名
성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.