ubuntu – 如何在php中安装GD库?

前端之家收集整理的这篇文章主要介绍了ubuntu – 如何在php中安装GD库?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
当我尝试在 PHP中使用imagefromjpeg()函数时,它抛出了错误.所以,我尝试使用以下命令安装GD库:
sudo apt-get install PHP5-gd

但是我收到了以下错误.

PHP5-gd : Depends: PHP5-common (= 5.5.9+dfsg-1ubuntu4) but 5.5.10+dfsg-1+deb.sury.org~saucy+1 is to be installed
E: Unable to correct problems,you have held broken packages.

我使用的是Ubuntu 14.04LTS.我最近从ubuntu 13.10升级了我的操作系统.
如何克服这个错误

dpkg -l | grep PHP输出是:

ii  cakePHP                                               1.3.15-1                                            all          MVC rapid application development framework for PHP
ii  cakePHP-scripts                                       1.3.15-1                                            all          MVC rapid application development framework for PHP (scripts)
ii  libapache2-mod-PHP5                                   5.5.10+dfsg-1+deb.sury.org~saucy+1                  amd64        server-side,HTML-embedded scripting language (Apache 2 module)
ii  libedit2:amd64                                        3.1-20130712-2+debPHP.org~saucy+3                   amd64        BSD editline and history libraries
ii  libjson-c2:amd64                                      0.11-3+debPHP.org~saucy+1                           amd64        JSON manipulation library - shared library
ii  libjson-c2:i386                                       0.11-3+debPHP.org~saucy+1                           i386         JSON manipulation library - shared library
ii  libjson0:amd64                                        0.11-3+debPHP.org~saucy+1                           amd64        JSON manipulation library (transitional package)
ii  PHP-gettext                                           1.0.11-1                                            all          read gettext MO files directly,without requiring anything other than PHP
ii  PHP-pear                                              5.5.10+dfsg-1+deb.sury.org~saucy+1                  all          PEAR - PHP Extension and Application Repository
ii  PHP5                                                  5.5.10+dfsg-1+deb.sury.org~saucy+1                  all          server-side,HTML-embedded scripting language (Metapackage)
ii  PHP5-cgi                                              5.5.10+dfsg-1+deb.sury.org~saucy+1                  amd64        server-side,HTML-embedded scripting language (CGI binary)
ii  PHP5-cli                                              5.5.10+dfsg-1+deb.sury.org~saucy+1                  amd64        command-line interpreter for the PHP5 scripting language
ii  PHP5-common                                           5.5.10+dfsg-1+deb.sury.org~saucy+1                  amd64        Common files for packages built from the PHP5 source
ii  PHP5-curl                                             5.5.10+dfsg-1+deb.sury.org~saucy+1                  amd64        CURL module for PHP5
ii  PHP5-dev                                              5.5.10+dfsg-1+deb.sury.org~saucy+1                  amd64        Files for PHP5 module development
rc  PHP5-gd                                               5.4.9-4ubuntu2.4                                    amd64        GD module for PHP5
ii  PHP5-imagick                                          3.1.2-1+debPHP.org~saucy+1                          amd64        ImageMagick module for PHP5
ii  PHP5-json                                             1.3.2-3+debPHP.org~saucy+1                          amd64        JSON module for PHP5
ii  PHP5-mcrypt                                           5.5.10+dfsg-1+deb.sury.org~saucy+1                  amd64        MCrypt module for PHP5
rc  PHP5-MysqL                                            5.4.9-4ubuntu2.4                                    amd64        MysqL module for PHP5
ii  PHP5-MysqLnd                                          5.5.10+dfsg-1+deb.sury.org~saucy+1                  amd64        MysqL module for PHP5 (Native Driver)
ii  PHP5-pgsql                                            5.5.10+dfsg-1+deb.sury.org~saucy+1                  amd64        Postgresql module for PHP5
ii  PHP5-readline                                         5.5.10+dfsg-1+deb.sury.org~saucy+1                  amd64        Readline module for PHP5
ii  PHP5-xdebug                                           2.2.3-2build1                                       amd64        Xdebug Module for PHP 5
ii  PHPmyadmin                                            4:4.0.10-1                                          all          MysqL web administration tool
ii  pkg-PHP-tools                                         1.11                                                all          varIoUs packaging tools and scripts for PHP packages
您似乎已通过启动板PPA安装了PHP

https://launchpad.net/~ondrej/+archive/php5

如果ppa仍处于活动状态,请检查您的apt sources.list.在14.04,你应该有这些repos活跃:

deb http://ppa.launchpad.net/ondrej/PHP5/ubuntu trusty main 
deb-src http://ppa.launchpad.net/ondrej/PHP5/ubuntu trusty main

说明:

您似乎之前添加了额外的PHP启动板存储库,但在dist-upgrade期间它已停用.因此,apt尝试从标准的debian repo安装PHP5-gd,但是这个版本还需要一个标准的PHP-common作为依赖(你没有).通过再次激活launchpad repo,已经安装了PHP5-gd,所有其他的PHP软件包应该已经从ppa升级到Ubuntu 14.04(“可靠”)版本.

猜你在找的Ubuntu相关文章