简体   繁体   中英

How to run Laravel 8 on MAMP?

I have this in my 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

I kept getting

Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.1.0". You are running 8.0.8. in /Users/laravel-app/vendor/composer/platform_check.php on line 24

macOS 12.3

php --version

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

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. Take your MAMP web server, and create a page that has nothing but <?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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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