The phar extension is missing. Install it or recompile php without --disable-phar

今天在linux下尝试安装composer时报了这个问题
在这里插入图片描述
查了好几个小时都没查到怎么安装这个拓展,最后只能转另一种思路了(重新编译php的时候把它删了!!)

先看一下自己的phpinfo的Configure Command 应该是有–disable-phar这个字眼的,就是这个引起的报错
The phar extension is missing. Install it or recompile php without --disable-phar_第1张图片
解决办法:
1.进如php安装目录,重新执行

 cd /usr/local/src/php-7.1.31/
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php --enable-mbstring --enable-ftp --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --without-pear --enable-sockets --with-freetype-dir=/usr --with-zlib --with-libxml-dir=/usr --with-xmlrpc --enable-zip --enable-fpm --enable-xml --enable-sockets --with-gd --with-zlib --with-iconv --enable-zip --with-freetype-dir=/usr/lib/ --enable-soap --enable-pcntl --enable-cli --with-curl
make && make install

2.再重新启动下php 即可发现已经没有了phar
The phar extension is missing. Install it or recompile php without --disable-phar_第2张图片
3.再重新安装composerThe phar extension is missing. Install it or recompile php without --disable-phar_第3张图片

即可

你可能感兴趣的:(php)