docker php80 安装composer 安装Laravel9
首先进入php容器
docker exec -ti php80 /bin/sh
php -r "copy('https://install.phpcomposer.com/installer', 'composer-setup.php');" php composer-setup.php #All settings correct for using Composer #Downloading... #Composer (version 2.6.5) successfully installed to: //composer.phar #Use it: php composer.phar # 移动 composer.phar,这样 composer 就可以进行全局调用: mv composer.phar /usr/local/bin/composer #切换为国内镜像: composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ #查看composer版本 composer -v #更新至最新版本 composer selfupdate
切换到www目录 执行composer安装命令
composer直接安装:
cd /www/ composer create-project laravel/laravel example-app cd example-app php artisan serve
通过lavavel安装器安装:
cd /www/ composer global require laravel/installer laravel new example-app cd example-app php artisan serve