MAMP 安装 PHP SSH2 扩展

MAMP 安装 ssh2 扩展
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#1. 安装 libssh2
brew install libssh2
#2. 下载ssh2源码包
curl -o ssh2.tgz http://pecl.php.net/get/ssh2-1.1.2.tgz
#3. 解压并安装
tar -zxvf ssh2.tgz
cd ssh2-1.1.2
phpize
./configure --with-php-config=/Applications/MAMP/bin/php/php7.2.14/bin/php-config
make
make install
#4. 修改 php.ini
extension=ssh2.so
#5. 重新启动 MAMP
phpize 报错
  1. 缺少PHP的header头文件

    1
    2
    3
    4
    5
    6
    7
    8
    9
    grep: /usr/include/php/main/php.h: No such file or directory
    grep: /usr/include/php/Zend/zend_modules.h: No such file or directory
    grep: /usr/include/php/Zend/zend_extensions.h: No such file or directory

    # 安装 Xcode command line tools
    xcode-select --install
    # 若报错 xcode-select: error: command line tools are already installed, use "Software Update" to install updates, 安装header头文件SDK
    cd /Library/Developer/CommandLineTools/Packages/
    open macOS_SDK_headers_for_macOS_10.14.pkg
  2. Cannot find autoconf.

    1
    2
    3
    4
    Cannot find autoconf. Please check your autoconf installation and the
    $PHP_AUTOCONF environment variable. Then, rerun this script.
    # 运行命令
    brew install autoconf
0%