composer global require "laravel/installer"
export PATH=$PATH:$HOME/.config/composer/vendor/bin (此方法为临时生效方法,永久生效方法是将此内容加到~/.profile文件的最下方并保存文件)
source ~/.profile
laravel new blog
如果出现permission denied 错误
比如
/root/.config/composer/vendor/bin/laravel /root/.config/composer/vendor/laravel/installer/laravel permission denied
如果提示缺少PHP扩展则安装对应扩展程序
ubuntu下:
sudo apt-get install php7.4-dom
sudo apt-get install php7.4-mbstring
或者直接使用composer进行生成新项目:
composer create-project --prefer-dist laravel/laravel blog
/usr/local/php7/bin/php -d memory_limit=-1 /usr/local/bin/composer create-project --prefer-dist laravel/laravel blog
错误请修改 laravel/installer 下laravel 权限 775
进入新安装的laravel blog 目录执行命令
chmod -R 775 ./storage
chown -R www ./storage