You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Windows电脑安装Laravel 8项目?已安装Composer仍无法安装的问题求助

在Windows上安装Laravel 8的完整步骤

Hey there! Let’s start with the standard installation process first—nice and straightforward once you’ve got the prerequisites sorted.

  • Check your environment first
    Laravel 8 requires PHP 7.3 to 8.1 (stick within this range for full compatibility) and several enabled extensions. Open Command Prompt or PowerShell and run these commands to verify:

    • php -v (confirm your PHP version meets the requirement)
    • composer -V (make sure Composer is correctly installed and accessible)
    • If you need to enable extensions, find your php.ini file with php --ini, then uncomment (remove the leading ; from) these lines:
      extension=openssl, extension=pdo_mysql, extension=mbstring, extension=tokenizer, extension=xml, extension=ctype, extension=json
  • Create your Laravel 8 project
    You’ve got two easy options here:

    1. Directly via Composer: Run this command to create a project with Laravel 8 specifically:
      composer create-project laravel/laravel:^8.0 your-project-name
      Replace your-project-name with whatever you want to call your app.
    2. Using the Laravel Installer: First install the installer compatible with Laravel 8:
      composer global require laravel/installer:^4.0
      Then create your project with:
      laravel new your-project-name --version=8.x
  • Test your installation
    Navigate into your project folder: cd your-project-name
    Run the development server: php artisan serve
    Open your browser and go to http://localhost:8000—you should see the Laravel welcome page if everything worked!

已有Composer但安装Laravel 8失败的排障方法

If Composer’s already set up but you’re still stuck, let’s troubleshoot the most common issues:

  • PHP version mismatch
    Double-check php -v—if your version is below 7.3 or above 8.1, Laravel 8 won’t install properly. Grab the correct PHP version from the official PHP site, update your system’s PATH environment variable to point to it, and restart your terminal.

  • Missing or disabled PHP extensions
    As mentioned earlier, missing extensions are a top culprit. Recheck your php.ini file to ensure all required extensions are enabled, then restart your terminal before trying again.

  • Composer cache corruption
    Old cache files can mess up dependency downloads. Clear the cache with:
    composer clear-cache
    Then re-run your project creation command.

  • Network issues blocking dependency downloads
    If you’re in a region with slow access to global Composer repositories, switch to a domestic mirror to speed things up:
    composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
    Try installing again after this.

  • Permission problems
    On Windows, sometimes regular user accounts don’t have write access to the directory where you’re creating the project. Right-click Command Prompt/PowerShell and select "Run as administrator", then try the installation command again.

  • Outdated Composer version
    Old Composer versions might not support Laravel 8’s dependency structure. Update Composer to the latest version with:
    composer self-update

内容的提问来源于stack exchange,提问作者Sajedur Rahman

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.30 08:17:32