紅色
執行命令:curl -sS https://getcomposer.org/installer | php
報錯如下
Some settings on your machine make Composer unable to work properly.
Make sure that you fix the issues listed below and run this script again:
The openssl extension is missing, which means that secure HTTPS transfers are impossible.
If possible you should enable it or recompile php with --with-openssl
沒有openssl擴展
cd php7.0/ext/openssl // 進入到openssl文件
phpize // 運行phpize
編譯和安裝
./configure --with-openssl --with-php-config=/usr/local/php/bin/php-config // 編譯和安裝
遇到報錯:
configure: error: Cannot find OpenSSL's <evp.h>
缺少openssl相關的庫,直接安裝即可
yum install openssl openssl-devel
遇到“configure: error: mcrypt.h not found. Please reinstall libmcrypt”
提示比較明確,缺少libmcrypt,直接安裝即可
yum install libmcrypt
最后執行 make && make install
進入最后提示的目錄 cp openssl.so /usr/local/php/include/php/ext
找到php.ini,在最后面添加如下內容: extension=openssl.so
重啟 后查看擴展: php -m
最后
mv composer.phar /usr/local/bin/composer