使用 webtatic 的 php56w 遇到了這個問題 Fatal error: Call to undefined function ssh2_connect()
Centos 7
一、安裝 php-pecl
方法 1:
(來源:https://www.rpmfind.net/linux/rpm2html/search.php?query=php-pecl-ssh2)
1 |
rpm -ivh ftp://195.220.108.108/linux/remi/enterprise/7/test/x86_64/php-pecl-ssh2-0.13-2.el7.remi.5.6.x86_64.rpm |
方法 2:
如果上面的方式失敗,可以試一下,下面的方法 2
安裝依賴套件
1 2 3 4 |
yum update yum install gcc yum install php-pear yum install libssh2-devel |
使用 pecl 安裝 SSH2 套件 PHP56w
1 |
pecl install -f ssh2 |
PHP 7 以上,則執行
1 |
pecl install -a ssh2-1.0 |
三、檢查 ssh2.so
1 |
ls /usr/lib64/php/modules/ | grep ssh2.so |
四、把套件加到 PHP
1 |
echo extension=ssh2.so > /etc/php.d/ssh2.ini |
五、重啟 PHP-FPM 或 APACHE
1 2 |
service php-fpm restart service httpd restart |