Fatal error: Call to undefined function
ssh2_connect()...
原因为目前的php缺少ssh2模块,现在将其安装过程记录如下:
1、下载libssh2
2、在解压缩后的目录执行:
configure--prefix=INSTALL_DIR_LIBSSH2
make
make install
注:INSTALL_DIR_LIBSSH2为libssh2的安装路径,如make install失败请检查权限。
3、下载php的ssh2库
4、在解压缩后的目录执行:
phpize
configure
--with-php-config=INSTALL_DIR_PHP/bin/php-config
--with-ssh2=INSTALL_DIR_LIBSSH2
make
make install
注:INSTALL_DIR_LIBSSH2为libssh2的安装路径,INSTALL_DIR_PHP为php的安装路径
make
install步骤提示编译生成的so文件的路径
5、设置php.ini中的extension_dir为上述路径,例如:
extension_dir =
"php安装路径/lib/php/extensions/no-debug-non-zts-20131226"
设置extension,例如:
extension=ssh2.so
安装完毕之后,再次执行没有提示错误。如果依然有错误提示,请尝试php -c 指定php.ini所在目录。