安装 composer:https://lulublog.cn/p/aHXse2
切换 www 用户
sudo su - www -s /bin/bash
下载 laravel
composer create-project laravel/laravel=5.1.* laravel5.1
该命令会在当前目录下创建一个新的名为 web 的应用
如果报错
Could not find package laravel/laravel with stability stable.
其实就是composer 的中国镜像出了问题,换成另外一个地址就行了
composer config -g repo.packagist composer https://packagist.org
阿里镜像
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer
运行
cd laravel5.1
php artisan serve
运行结果
Laravel development server started on http://localhost:8000/
也可以运行
php -S localhost:8888 -t public
运行结果
PHP 7.4.33 Development Server (http://localhost:8888) started