comporserのインストール
curl -sS https://getcomposer.org/installer -o /tmp/composer-setup.php php /tmp/composer-setup.php
実行したディレクトリにcomposer.phar
ができます。
php ~/composer.phar install
とかphp ~/composer.phar update
で実行できました。
ubuntuでのComposerインストール方法を簡潔に - Qiita
$ # PHP と同じディレクトリに拡張子なしで移動し、実行権限を与える $ mv ./composer.phar $(dirname $(which php))/composer && chmod +x "$_"
手動で、パスの通ったディレクトリに置く作法なんですか・・・?
How To Install and Use Composer on Ubuntu 20.04 | DigitalOcean
sudo php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer
インストール時にインストール先と名前が指定できるみたいです。
依存ライブラリのインストール
composer
コマンドの実行時に次のエラーがでることがあります。
ledsun@MSI:~/►php ~/composer.phar update PHP Warning: PHP Startup: Unable to load dynamic library 'curl' (tried: /usr/lib/php/20210902/curl (/usr/lib/php/20210902/curl: cannot open shared object file: No such file or directory), /usr/lib/php/20210902/curl.so (/usr/lib/php/20210902/curl.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Composer is operating significantly slower than normal because you do not have the PHP curl extension enabled. Loading composer repositories with package information
sudo apt install php8.1-curl
します。 次のエラーが出たときは
ledsun@MSI:~/►php ~/composer.phar update PHP Warning: Module "curl" is already loaded in Unknown on line 0 Loading composer repositories with package information Updating dependencies Your requirements could not be resolved to an installable set of packages. Problem 1 - phpunit/phpunit[9.5.10, ..., 9.5.x-dev] require ext-dom * -> it is missing from your system. Install or enable PHP's dom extension. - Root composer.json requires phpunit/phpunit ^9.5.10 -> satisfiable by phpunit/phpunit[9.5.10, ..., 9.5.x-dev]. To enable extensions, verify that they are enabled in your .ini files: - /etc/php/8.1/cli/php.ini - /etc/php/8.1/cli/conf.d/10-opcache.ini - /etc/php/8.1/cli/conf.d/10-pdo.ini - /etc/php/8.1/cli/conf.d/20-calendar.ini - /etc/php/8.1/cli/conf.d/20-ctype.ini - /etc/php/8.1/cli/conf.d/20-curl.ini - /etc/php/8.1/cli/conf.d/20-exif.ini - /etc/php/8.1/cli/conf.d/20-ffi.ini - /etc/php/8.1/cli/conf.d/20-fileinfo.ini - /etc/php/8.1/cli/conf.d/20-ftp.ini - /etc/php/8.1/cli/conf.d/20-gettext.ini - /etc/php/8.1/cli/conf.d/20-iconv.ini - /etc/php/8.1/cli/conf.d/20-phar.ini - /etc/php/8.1/cli/conf.d/20-posix.ini - /etc/php/8.1/cli/conf.d/20-readline.ini - /etc/php/8.1/cli/conf.d/20-shmop.ini - /etc/php/8.1/cli/conf.d/20-sockets.ini - /etc/php/8.1/cli/conf.d/20-sysvmsg.ini - /etc/php/8.1/cli/conf.d/20-sysvsem.ini - /etc/php/8.1/cli/conf.d/20-sysvshm.ini - /etc/php/8.1/cli/conf.d/20-tokenizer.ini You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode. Alternatively, you can run Composer with `--ignore-platform-req=ext-dom` to temporarily ignore these required extensions.
sudo apt install php8.1-dom
します。