简体   繁体   English

如何在 MAMP 上运行 Laravel 8?

[英]How to run Laravel 8 on MAMP?

I have this in my composer.json我的composer.json中有这个

"require": {
    "php": "^8",
    "alkhachatryan/laravel-web-console": "^3.3",
    "barryvdh/laravel-dompdf": "^0.9.0",
    "doctrine/dbal": "^2.10",
    "fideloper/proxy": "^4.2",
    "fruitcake/laravel-cors": "^1.0",
    "guzzlehttp/guzzle": "^6.3",
    "intervention/image": "^2.3",
    "laravel/framework": "^8",
    "laravel/tinker": "^2.0",
    "laravelcollective/html": "~6.0",
    "league/flysystem-aws-s3-v3": "~1.0",
    "pusher/pusher-php-server": "^4.1"
},

I'm trying to run my Laravel app via MAMP v6.6我正在尝试通过 MAMP v6.6 运行我的 Laravel 应用程序

I kept getting我不断得到

Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.1.0".致命错误:Composer 在您的平台中检测到问题:您的 Composer 依赖项需要 PHP 版本“>= 8.1.0”。 You are running 8.0.8.您正在运行 8.0.8。 in /Users/laravel-app/vendor/composer/platform_check.php on line 24在 /Users/laravel-app/vendor/composer/platform_check.php 第 24 行

macOS 12.3 macOS 12.3

php --version php——版本

PHP 8.1.8 (cli) (built: Jul 8 2022 10:46:35) (NTS) Copyright (c) The PHP Group Zend Engine v4.1.8, Copyright (c) Zend Technologies with Zend OPcache v8.1.8, Copyright (c), by Zend Technologie PHP 8.1.8 (cli) (built: Jul 8 2022 10:46:35) (NTS) Copyright (c) The PHP Group Zend Engine v4.1.8, Copyright (c) Zend Technologies with Zend OPcache v8.1.8, Copyright ( c), 由 Zend Technologie

You need to realize that you have 2 versions of PHP installed on that Mac -- one is a web server, and one is a command line.您需要意识到您在那台 Mac 上安装了 PHP 的 2 个版本——一个是 web 服务器,一个是命令行。 Take your MAMP web server, and create a page that has nothing but <?php phpinfo();使用您的 MAMP web 服务器,创建一个页面,其中只有<?php phpinfo(); in it.在里面。 Then, visit that web page and it will give you a long list of information including the version of PHP. Usually you want to have the command line version and the web server version to be in sync, but that's your perogative.然后,访问那个 web 页面,它会给你一长串信息,包括 PHP 的版本。通常你希望命令行版本和 web 服务器版本同步,但这是你的权利。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM