I'm trying to install composer on my server (centos) but I keep getting this error : The phar extension is missing. Install it or recompile php without --disable-phar ps:I am trying to install composer to work with laravel
Specifically for CentOS
Edit the file /etc/php.d/20-phar.ini
and remove the ;
character in front of the line:
extension=phar.so
Now the phar extension is enabled.
Composer is provided as a phar as that extension is a standard part of PHP 5.3 which is also the minimum required version for running Composer at all.
If you have a weird version of PHP 5.3+ without the phar extension you could also convert it to a zipball or tarball via online tools , unpack it to /usr/local/share/composer
, and then symlink manually from /usr/local/bin/composer
to /usr/local/share/composer/bin/composer
. Assuming no other settings are preventing installation that should work as well.
PHAR is part of the PHP core since some years now. Its already installed as dynamic/shared extension, but probably and simply not activated in your case
Please check your php extension folder for a file "phar.so".
To enable the extension:
php.ini
and enable extension = phar.so
php -m
and look for "Phar" First, you need to get composer.phar by doing :
curl -sS https://getcomposer.org/installer | php
And move the composer.phar for using globally :
mv composer.phar /usr/local/bin/composer
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.