【问题标题】:laravel installation error in ubuntu 16.04ubuntu 16.04中的laravel安装错误
【发布时间】:2016-08-29 07:44:23
【问题描述】:

我在 laravel 中安装错误时遇到问题。 首先在 ubuntu 16.04 中安装 xampp。 之后

cd /opt/lampp/htdocs/
composer create-project --prefer-dist laravel/laravel blog

用 composer 安装 laravel 出现一些错误

E: Package 'php5-mcrypt' has no installation candidate
shwekayin@shwekayin-VirtualBox:/opt/lampp/htdocs$ composer create-project --prefer-dist laravel/laravel blog1
Installing laravel/laravel (v5.3.0)
  - Installing laravel/laravel (v5.3.0)
    Loading from cache

Created project in blog1
> php -r "file_exists('.env') || copy('.env.example', '.env');"
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
    - laravel/framework v5.3.4 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.3.3 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.3.2 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.3.1 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.3.0 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - Installation request for laravel/framework 5.3.* -> satisfiable by laravel/framework[v5.3.0, v5.3.1, v5.3.2, v5.3.3, v5.3.4].

  To enable extensions, verify that they are enabled in those .ini files:
    - /etc/php/7.0/cli/php.ini
    - /etc/php/7.0/cli/conf.d/10-opcache.ini
    - /etc/php/7.0/cli/conf.d/10-pdo.ini
    - /etc/php/7.0/cli/conf.d/20-calendar.ini
    - /etc/php/7.0/cli/conf.d/20-ctype.ini
    - /etc/php/7.0/cli/conf.d/20-exif.ini
    - /etc/php/7.0/cli/conf.d/20-fileinfo.ini
    - /etc/php/7.0/cli/conf.d/20-ftp.ini
    - /etc/php/7.0/cli/conf.d/20-gettext.ini
    - /etc/php/7.0/cli/conf.d/20-iconv.ini
    - /etc/php/7.0/cli/conf.d/20-json.ini
    - /etc/php/7.0/cli/conf.d/20-phar.ini
    - /etc/php/7.0/cli/conf.d/20-posix.ini
    - /etc/php/7.0/cli/conf.d/20-readline.ini
    - /etc/php/7.0/cli/conf.d/20-shmop.ini
    - /etc/php/7.0/cli/conf.d/20-sockets.ini
    - /etc/php/7.0/cli/conf.d/20-sysvmsg.ini
    - /etc/php/7.0/cli/conf.d/20-sysvsem.ini
    - /etc/php/7.0/cli/conf.d/20-sysvshm.ini
    - /etc/php/7.0/cli/conf.d/20-tokenizer.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

如何解决此错误。我的 xampp php 版本是 7.0.10

【问题讨论】:

    标签: php laravel ubuntu installation ubuntu-16.04


    【解决方案1】:

    错误消息详细说明出了什么问题:

    laravel/framework v5.3.4 需要 ext-mbstring * -> 您的系统中缺少请求的 PHP 扩展 mbstring。

    运行sudo apt install php-mbstring进行安装。

    【讨论】:

      【解决方案2】:

      运行这个

      sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql
      

      如果您不需要再次更新 php 7,只需运行此

      sudo apt-get install php-mcrypt 
      

      也安装这些可选组件

      libnet-libidn-perl - Perl bindings for GNU Libidn
      php-all-dev - package depending on all supported PHP development packages
      php-cgi - server-side, HTML-embedded scripting language (CGI binary) (default)
      php-cli - command-line interpreter for the PHP scripting language (default)
      php-common - Common files for PHP packages
      php-curl - CURL module for PHP [default]
      php-dev - Files for PHP module development (default)
      php-gd - GD module for PHP [default]
      php-gmp - GMP module for PHP [default]
      
      sudo apt-get install package_name
      

      有史以来最好的教程How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu 16.04 - 对我有用并且对我有用

      【讨论】:

      • 问题 1 - phpunit/phpunit 5.5.4 需要 ext-dom * -> 您的系统中缺少请求的 PHP 扩展 dom。 - phpunit/phpunit 5.5.3 需要 ext-dom * -> 您的系统中缺少请求的 PHP 扩展 dom。
      【解决方案3】:

      默认情况下,Ubuntu 16.04 安装了 php7.0。您需要先安装 php5(在您的情况下)。然后在重新安装laravel之前切换到php5。

      https://askubuntu.com/questions/756879/cant-install-php5-on-ubuntu-16-04

      【讨论】:

        猜你喜欢
        • 2018-02-25
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多