2016-09-08 112 views
6

我通過作曲者(composer require barryvdh/laravel-dompdf)在Laravel Project中新安裝Dompdf。輸入命令終端應答錯誤後。系統中缺少擴展名gd - laravel作曲者更新

Problem 1 
    - dompdf/dompdf v0.7.0 requires ext-gd * -> the requested PHP extension gd is missing from your system. 
    - barryvdh/laravel-dompdf v0.7.0 requires dompdf/dompdf ^0.7 -> satisfiable by dompdf/dompdf[v0.7.0]. 
    - Installation request for barryvdh/laravel-dompdf ^0.7.0 -> satisfiable by barryvdh/laravel-dompdf[v0.7.0]. 

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

如何解決這個錯誤

我已經使用了以下注釋安裝GD。 sudo apt-get install php5-gd以及Apache服務器重新啓動。我的Laravel版本是5.3和Ubuntu版本是14.04

+0

sudo apt-get install your-php-version-gd爲我做了。啓用GD顯示以下錯誤後啓用 – Picrasma

回答

4

它可能未啓用php-cli,您可以啓用這樣的功能;

sudo phpenmod gd 

UPDATE

我猜,你正在使用PPA:PHP的Ondrej包(5.6),這是混淆了你與Ubuntu默認14.04 php軟件包(5.5.9)。

安裝PHP收購價格5.6 GD庫:的Ondrej,你應該使用:

sudo apt-get install php5.6-gd 
+0

。警告:在/etc/php/5.6/mods-available下不存在模塊gd ini文件 – Karthik

+0

Hera是您的問題的解決方案http://laravel.io/forum/05-30-2014-mcrypt-php-extension-要求 –

+0

我建議你方法。但我得到同樣的錯誤。 @VaheGalstyan – Karthik

2

解決的辦法很簡單。

在php.ini,只是取消對該行extension=php_gd2.dll(或.so擴展UNIX系統。)

希望它能幫助。

19

我已經安裝了PHP7,我做了以下恰好解決了同樣的錯誤

sudo apt-get install php7.0-gd 
sudo apt-get install php7.0-intl 
sudo apt-get install php7.0-xsl 
+4

只是做'sudo apt-get安裝php7.0-gd'爲我工作。 –

1

打開的php.ini並取消這一行:

;extension=php_gd2.dll

3

如果你是在PHP版本5中工作。*然後你必須安裝

sudo apt-get install php5-gd 

如果你是在PHP版本工作7 *,那麼你必須安裝

sudo apt-get install php7.0-gd 

希望它會工作...

+0

以下是使用SCL和PHP 7.1時的CentOS 7節:'yum install rh-php71-php-gd'。 – jww

0

對於PHP 7.1

sudo apt-get install php7.1-gd 

乾杯!