Linux安装composer遇到的坑

执行命令:

curl -sS [https://getcomposer.org/installer](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扩展


Solve Question

进入到openssl文件

cd /usr/local/src/php-5.6.27/ext/openssl

运行phpize

phpize 

编译和安装

./configure --with-openssl --with-php-config=/usr/local/php/bin/php-config 

最后执行 make && make install

 make && make install

进入最后提示的目录

 cp openssl.so /usr/local/php/include/php/ext

找到php.ini,在最后面添加如下内容:

 extension=openssl.so

或者绝对路径:

extension=/usr/local/php/include/php/ext/openssl.so
;extension=/usr/local/php/include/php/ext/pdo_mysql.so

重启php后查看扩展:

php -m
Linux安装composer遇到的坑_第1张图片
openssl.png

这中间可能出现的报错和解决方法如下:
遇到报错:

configure: error: Cannot find OpenSSL‘s 

缺少openssl相关的库,直接安装即可

yum install openssl openssl-devel

遇到

“configure: error: mcrypt.h not found. Please reinstall libmcrypt”

提示比较明确,缺少libmcrypt,直接安装即可

yum install libmcrypt

你可能感兴趣的:(Linux安装composer遇到的坑)