linux ubantu php composerインストール

4025 ワード

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
--enable-maintainer-zts .
/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