Extension gd is missing from your system - laravel composer Update

前端 未结 13 2140
野趣味
野趣味 2021-01-31 14:00

I newly install Dompdf in Laravel Project via Composer (composer require barryvdh/laravel-dompdf). After enter the Command Terminal Reply Following Errors.

相关标签:
13条回答
  • 2021-01-31 14:18

    Before installing the missing dependency, you need to check which version of PHP is installed on your system.

    php -v
    PHP 7.2.10-0ubuntu0.18.04.1 (cli) (built: Sep 13 2018 13:45:02) ( NTS )
    Copyright (c) 1997-2018 The PHP Group
    Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
        with Zend OPcache v7.2.10-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies
    

    In this case it's php7.2. apt search php7.2 returns all the available PHP extensions.

    apt search php7.2
    Sorting... Done
    Full Text Search... Done
    libapache2-mod-php7.2/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
      server-side, HTML-embedded scripting language (Apache 2 module)
    
    libphp7.2-embed/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
      HTML-embedded scripting language (Embedded SAPI library)
    
    php-all-dev/bionic,bionic 1:60ubuntu1 all
      package depending on all supported PHP development packages
    
    php7.2/bionic-updates,bionic-updates,bionic-security,bionic-security 7.2.10-0ubuntu0.18.04.1 all
      server-side, HTML-embedded scripting language (metapackage)
    
    php7.2-bcmath/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
      Bcmath module for PHP
    
    php7.2-bz2/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
      bzip2 module for PHP
    
    php7.2-cgi/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
      server-side, HTML-embedded scripting language (CGI binary)
    
    php7.2-cli/bionic-updates,bionic-security,now 7.2.10-0ubuntu0.18.04.1 amd64 [installed,automatic]
      command-line interpreter for the PHP scripting language
    
    php7.2-common/bionic-updates,bionic-security,now 7.2.10-0ubuntu0.18.04.1 amd64 [installed,automatic]
      documentation, examples and common module for PHP
    
    php7.2-curl/bionic-updates,bionic-security,now 7.2.10-0ubuntu0.18.04.1 amd64 [installed]
      CURL module for PHP
    
    php7.2-dba/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
      DBA module for PHP
    
    php7.2-dev/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
      Files for PHP7.2 module development
    
    php7.2-enchant/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
      Enchant module for PHP
    
    php7.2-fpm/bionic-updates,bionic-security,now 7.2.10-0ubuntu0.18.04.1 amd64 [installed]
      server-side, HTML-embedded scripting language (FPM-CGI binary)
    
    php7.2-gd/bionic-updates,bionic-security,now 7.2.10-0ubuntu0.18.04.1 amd64 [installed]
      GD module for PHP
    
    php7.2-gmp/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
      GMP module for PHP
    
    php7.2-imap/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
      IMAP module for PHP
    
    php7.2-interbase/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
      Interbase module for PHP
    
    php7.2-intl/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
      Internationalisation module for PHP
    
    php7.2-json/bionic-updates,bionic-security,now 7.2.10-0ubuntu0.18.04.1 amd64 [installed,automatic]
      JSON module for PHP
    
    php7.2-ldap/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
      LDAP module for PHP
    
    php7.2-mbstring/bionic-updates,bionic-security,now 7.2.10-0ubuntu0.18.04.1 amd64 [installed,automatic]
      MBSTRING module for PHP
    
    php7.2-mysql/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
      MySQL module for PHP
    
    php7.2-odbc/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
      ODBC module for PHP
    
    php7.2-opcache/bionic-updates,bionic-security,now 7.2.10-0ubuntu0.18.04.1 amd64 [installed,automatic]
      Zend OpCache module for PHP
    
    php7.2-pgsql/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
      PostgreSQL module for PHP
    
    php7.2-phpdbg/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
      server-side, HTML-embedded scripting language (PHPDBG binary)
    
    php7.2-pspell/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
      pspell module for PHP
    
    php7.2-readline/bionic-updates,bionic-security,now 7.2.10-0ubuntu0.18.04.1 amd64 [installed,automatic]
      readline module for PHP
    
    php7.2-recode/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
      recode module for PHP
    
    php7.2-snmp/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
      SNMP module for PHP
    
    php7.2-soap/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
      SOAP module for PHP
    
    php7.2-sqlite3/bionic-updates,bionic-security,now 7.2.10-0ubuntu0.18.04.1 amd64 [installed]
      SQLite3 module for PHP
    
    php7.2-sybase/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
      Sybase module for PHP
    
    php7.2-tidy/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
      tidy module for PHP
    
    php7.2-xml/bionic-updates,bionic-security,now 7.2.10-0ubuntu0.18.04.1 amd64 [installed]
      DOM, SimpleXML, WDDX, XML, and XSL module for PHP
    
    php7.2-xmlrpc/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
      XMLRPC-EPI module for PHP
    
    php7.2-xsl/bionic-updates,bionic-updates,bionic-security,bionic-security 7.2.10-0ubuntu0.18.04.1 all
      XSL module for PHP (dummy)
    
    php7.2-zip/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
      Zip module for PHP
    

    You can now proceed to installing the missing dependency by running:

    sudo apt install php7.2-gd

    0 讨论(0)
  • 2021-01-31 14:22

    If you are working in PHP version 5.* then you have to install

    sudo apt-get install php5-gd
    

    And if you are working in PHP version 7.* then you have to install

    sudo apt-get install php7.0-gd
    

    Hope it will work...

    And if you are working in PHP version 7.2 then you have to install

    sudo apt-get install php7.2-gd... it worked for me
    
    0 讨论(0)
  • 2021-01-31 14:22

    For php 7.1

    sudo apt-get install php7.1-gd
    

    Cheers!

    0 讨论(0)
  • 2021-01-31 14:24

    I have installed php7, I did the following to solve exactly the same error

    sudo apt-get install php7.0-gd
    sudo apt-get install php7.0-intl
    sudo apt-get install php7.0-xsl
    
    0 讨论(0)
  • 2021-01-31 14:28

    PHP 7.4.2 (cli) (built: Feb 5 2020 16:50:21) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.2, Copyright (c), by Zend Technologies

    For Php 7.4.2

    1. sudo apt-get install php7.4-gd
    2. sudo phpenmod gd
    0 讨论(0)
  • 2021-01-31 14:30

    It may not be enabled for php-cli, you can enable like this;

    sudo phpenmod gd
    

    UPDATE

    I guess, you are using ppa:ondrej php package (5.6), which is confusing you with default ubuntu 14.04 php package (5.5.9).

    To install php 5.6 gd library from ppa:ondrej, you should use:

    sudo apt-get install php5.6-gd
    
    0 讨论(0)
提交回复
热议问题