linux ubantu php composer安装

root@iZwz93telmwbh624e5zetqZ:~# php -v
PHP 5.6.40-14+ubuntu16.04.1+deb.sury.org+1 (cli) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
    with Xdebug v2.5.5, Copyright (c) 2002-2017, by Derick Rethans

root@iZwz93telmwbh624e5zetqZ:~# php -m

root@iZwz93telmwbh624e5zetqZ:~# php -m|grep -i 'phar'
root@iZwz93telmwbh624e5zetqZ:~# php -m|grep -i 'openssl'

root@iZwz93telmwbh624e5zetqZ:~# php --ini
Configuration File (php.ini) Path: /etc/php/5.6/cli
Loaded Configuration File:         /etc/php/5.6/cli/php.ini
Scan for additional .ini files in: /etc/php/5.6/cli/conf.d
Additional .ini files parsed:      /etc/php/5.6/cli/conf.d/10-mysqlnd.ini

root@iZwz93telmwbh624e5zetqZ:~# cd /etc/php/5.6/cli/conf.d
root@iZwz93telmwbh624e5zetqZ:/etc/php/5.6/cli/conf.d# cp -a /etc/php/5.6/apache2/conf.d/* ./
root@iZwz93telmwbh624e5zetqZ:~# php --ini
root@iZwz93telmwbh624e5zetqZ:~# php -m|grep -i 'phar'
root@iZwz93telmwbh624e5zetqZ:~# php -m|grep -i 'openssl'

root@iZwz93telmwbh624e5zetqZ:~/download# cd /root/download
root@iZwz93telmwbh624e5zetqZ:~/download# curl -k -sS https://getcomposer.org/installer | php
root@iZwz93telmwbh624e5zetqZ:/etc/php/5.6/cli/conf.d# mv /root/download/composer.phar /usr/local/bin/composer
root@iZwz93telmwbh624e5zetqZ:/etc/php/5.6/cli/conf.d# chmod +x /usr/local/bin/composer
root@iZwz93telmwbh624e5zetqZ:/etc/php/5.6/cli/conf.d# composer -V
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Composer version 1.10-dev (1.10-dev+f05e78aa9ee48a317142543da8b9c02613951273) 2019-12-07 20:17:56

说明:

composer安装依赖php,要先安装php,且php安装扩展phar和openssl模块,php cli和apche cgi使用的不是同一个php.ini文件,建议使用源码安装时候指定编译参数/etc/php.ini和/etc/php.d可以让php cli跟cgi使用同样的php.ini配置文件

--with-openssl
--with-pear 
--enable-phar 
--with-config-file-scan-dir=/etc/php.d
--with-config-file-path=/etc

./configure --prefix=/usr/local/php  --with-apxs2=/usr/bin/apxs --with-config-file-scan-dir=/etc/php.d  --with-config-file-path=/etc  --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-rpath  --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl  --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --with-tidy --enable-zip --enable-soap --with-gettext --with-xsl --with-pear --enable-phar  --enable-opcache --enable-fileinfo --enable-wddx  --enable-static --enable-sysvshm --enable-sysvmsg --enable-shared --enable-apc --enable-apc-mmap --enable-apu

猜你喜欢

转载自www.cnblogs.com/hnhycnlc888/p/12023981.html
今日推荐