【问题标题】:(Solved) Laravel New Installation - Removing PHP 7.1.23 from Mac without Brew(已解决)Laravel 全新安装 - 在没有 Brew 的情况下从 Mac 中删除 PHP 7.1.23
【发布时间】:2020-06-28 20:05:04
【问题描述】:

解决方案:我已将我的操作系统更新到支持最新 PHP 的最新版本。

我有一个新的 laravel 项目 当我运行php artisan serve 它显示:

MacBook-Pro% php artisan serve

Warning: require(/Users/username/Desktop/code/argon/vendor/autoload.php): failed to open stream: No such file or directory in /Users/username/Desktop/code/argon/artisan on line 18

Fatal error: require(): Failed opening required '/Users/username/Desktop/code/argon/vendor/autoload.php' (include_path='.:') in /Users/username/Desktop/code/argon/artisan on line 18

composer update 显示

MacBook-Pro% composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - This package requires php ^7.2.5 but your PHP version (7.1.23) does not satisfy that requirement.
  Problem 2
    - laravel/tinker v2.2.0 requires php ^7.2 -> your PHP version (7.1.23) does not satisfy that requirement.
    - laravel/tinker v2.1.0 requires php ^7.2 -> your PHP version (7.1.23) does not satisfy that requirement.
    - laravel/tinker v2.0.0 requires php ^7.2 -> your PHP version (7.1.23) does not satisfy that requirement.
    - laravel/tinker 2.x-dev requires php ^7.2 -> your PHP version (7.1.23) does not satisfy that requirement.
    - Installation request for laravel/tinker ^2.0 -> satisfiable by laravel/tinker[2.x-dev, v2.0.0, v2.1.0, v2.2.0].



MacBook-Pro% php -v
PHP 7.1.23 (cli) (built: Nov  7 2018 18:20:35) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies

还有

MacBook-Pro% brew unlink php@7.1
Error: No such keg: /usr/local/Cellar/php@7.1
MacBook-Pro% brew unlink php71
Error: No such keg: /usr/local/Cellar/php71

还有

MacBook-Pro% which php
/usr/bin/php

任何想法如何删除 php 7.1.23 ?

【问题讨论】:

  • 你必须有一个非常旧的 macOS 版本。您不能删除 PHP 的系统版本。安装一个较新的。
  • 这是 MacOS Mojave v10.14.3

标签: php laravel macos composer-php


【解决方案1】:

找到了解决办法!

brew install php72
brew switch php@7.2 7.2.25

https://laravel.com/docs/6.x/homestead

【讨论】:

    【解决方案2】:

    php -v 给出以下响应:

    WARNING: PHP is not recommended  
    PHP is included in macOS for compatibility with legacy software.  
    Future versions of macOS will not include PHP.
    The release notes for Catalina contain the following remark:
    

    Info here

    脚本语言运行时弃用脚本语言运行时 例如 Python、Ruby 和 Perl 都包含在 macOS 中以实现兼容性 与旧版软件。 macOS 的未来版本将不包含脚本 默认情况下的语言运行时,可能需要您安装 附加包。如果您的软件依赖于脚本语言, 建议您将运行时捆绑在应用程序中。

    简而言之:macOS 继续包含诸如 Python、Ruby、Perl 甚至 PHP 之类的“旧版”版本,因此现有代码不会中断,但 Apple 将其留给用户安装他们自己喜欢的版本想用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-01-18
      • 1970-01-01
      • 1970-01-01
      • 2020-12-20
      • 2015-04-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多