Azure Web Apps Composer Fail (GD Extension) [duplicate] - php

I newly install Dompdf in Laravel Project via Composer (composer require barryvdh/laravel-dompdf). After enter the Command Terminal Reply Following Errors.
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.
How to Solve this Error
I already Installed GD using Following comment. sudo apt-get install php5-gd and also Apache Server Restarted. My Laravel Version is 5.3 and Ubuntu Version is 14.04

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

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

For php-8, just locate your php.ini file and uncomment the line extension=gd
Below is a picture guide for those using Xampp and Windows
Step 1: Open php.ini or locate it in your machine (C:/xampp/php/php.ini)
Step 2: Uncomment the line extension=gd by removing the semicolon
Step 3: Save your file and restart your services

Open your php.ini and uncomment this line:
;extension=php_gd2.dll

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

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
sudo apt-get install php7.4-gd
sudo phpenmod gd

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

if you are working in PHP version 7.2 then you have to install
sudo apt-get install php7.2-gd

For php 7.1
sudo apt-get install php7.1-gd
Cheers!

I'm working on php 8.0.9, and I just uncomment this on php.ini in xampp/php/php.ini directory.
from
;extension=gd
to
extension=gd
and it's work normal again

The solution is quite simple.
In your php.ini, just uncomment the line extension=php_gd2.dll (or .so extension for unix systems.)
Hope it helps.

This worked for me:
composer require "ext-gd:*" --ignore-platform-reqs

As of Composer 2.0 on Arch, I use: --ignore-platform-req=ext-gd
Eg:
php composer install -n --ignore-platform-req=ext-gd
Eg: (to ignore multiple requirements)
php composer install -n --ignore-platform-req=ext-gd --ignore-platform-req=ext-ldap
Ignoring Composer requirements may be necessary because Composer may return false warnings on dependencies that are already properly installed and enabled, consider this Arch forum article:
I have installed php-gd and uncommeted extension=gd.so in /etc/php/php.ini as the wiki says
Thanks for this answer on a related Question, How to always use ignore-platform-reqs flag when running composer?

Using Manjaro(Arch) Linux:
$ sudo pacman -S php-gd
In file /etc/php/php-ini, add the line:
extension=gd.so

For Windows :
Uncomment this line in your php.ini file
;extension=php_gd2.dll
If the above step doesn't work uncomment the following line as well:
;extension=gd2

sudo apt-get install php7.4-zip
Use your version of php. Like here I used 7.4

CentOS
sudo yum install php-gd
Unbuntu
sudo apt install php-gd

First Check your php version
sudo php -v
Then install php gd package of relevent version.
sudo apt-get install php${version}-gd
Finally run
composer update

On CentOS 7, try running following command:
sudo yum install php72u-gd.x86_64

in docker I found a same problem, even after
"rm /etc/apt/preferences.d/no-debian-php"
then
"apt update"
"apt install php7.4-gd"
"php composer.phar update"
error " ..... ext-gd ....."
so my solution is direct using php7.4
"php7.4 composer.phar update"
and its work. I dont know why.

It may help you
apt install php-xml
systemctl restart apache2
From reference here, you may learn in brief.
Thanks :)

On Local or Xampp in windows
go to : C:\xampp\php\php.ini
uncomment extension=gd

PHP VERSION - 7.3.21
WAMP SERVER
// use below command to fix ext-gd issue
// work for me
composer require "ext-gd:*" --ignore-platform-reqs phpoffice/phpspreadsheet

Related

Getting MySQLi error on Moodle Setup on Ubuntu 18.04 with PHP7.4 [duplicate]

I have installed PHP 7 and MySQL 5.5.47 on Ubuntu 14.04 (Trusty Tahr).
I have checked installed extension using:
sudo apt-cache search php7-*
It outputs:
php7.0-common - Common files for packages built from the PHP source
libapache2-mod-php7.0 - server-side, HTML-embedded scripting language (Apache 2 module)
php7.0-cgi - server-side, HTML-embedded scripting language (CGI binary)
php7.0-cli - command-line interpreter for the PHP scripting language
php7.0-phpdbg - server-side, HTML-embedded scripting language (PHPDBG binary)
php7.0-fpm - server-side, HTML-embedded scripting language (FPM-CGI binary)
libphp7.0-embed - HTML-embedded scripting language (Embedded SAPI library)
php7.0-dev - Files for PHP7.0 module development
php7.0-dbg - Debug symbols for PHP7.0
php7.0-curl - CURL module for PHP
php7.0-enchant - Enchant module for PHP
php7.0-gd - GD module for PHP
php7.0-gmp - GMP module for PHP
php7.0-imap - IMAP module for PHP
php7.0-interbase - Interbase module for PHP
php7.0-intl - Internationalisation module for PHP
php7.0-ldap - LDAP module for PHP
php7.0-mcrypt - libmcrypt module for PHP
php7.0-readline - readline module for PHP
php7.0-odbc - ODBC module for PHP
php7.0-pgsql - PostgreSQL module for PHP
php7.0-pspell - pspell module for PHP
php7.0-recode - recode module for PHP
php7.0-snmp - SNMP module for PHP
php7.0-tidy - tidy module for PHP
php7.0-xmlrpc - XMLRPC-EPI module for PHP
php7.0-xsl - XSL module for PHP
php7.0 - server-side, HTML-embedded scripting language (metapackage)
php7.0-json - JSON module for PHP
php-all-dev - package depending on all supported PHP development packages
php7.0-sybase - Sybase module for PHP
php7.0-sqlite3 - SQLite3 module for PHP
php7.0-mysql - MySQL module for PHP
php7.0-opcache - Zend OpCache module for PHP
php7.0-bz2 - bzip2 module for PHP
I am not able to see the MySQLi extension using phpinfo() either. How can I enable/install MySQLi extension in PHP 7?
That's why I cannot use phpMyAdmin. It says "The mysqli extension is missing."
The problem is that the package that used to connect PHP to MySQL is deprecated (php5-mysql). If you install the new package,
sudo apt-get install php-mysql
this will automatically update Apache and PHP 7.
I got the solution. I am able to enable MySQLi extension in php.ini. I just uncommented this line in php.ini:
extension=php_mysqli.dll
Now MySQLi is working well. Here is the php.ini file path in an Apache 2, PHP 7, and Ubuntu 14.04 environment:
/etc/php/7.0/apache2/php.ini
By default, the MySQLi extension is disabled in PHP 7.
sudo phpenmod mysqli
sudo service apache2 restart
phpenmod moduleName enables a module to PHP 7 (restart Apache after that sudo service apache2 restart)
phpdismod moduleName disables a module to PHP 7 (restart Apache after that sudo service apache2 restart)
php -m lists the loaded modules
For all docker users, just run docker-php-ext-install mysqli from inside your php container.
Update: More information on https://hub.docker.com/_/php in the section "How to install more PHP extensions".
On Ubuntu, when mysqli is missing, execute the following,
sudo apt-get install php7.x-mysqli
sudo service apache2 restart
Replace 7.x with your PHP version.
Note: This could be 7.0 and up, but for example Drupal recommends PHP 7.2 on grounds of security among others.
To check your PHP version, on the command-line type:
php -v
You do exactly the same if you are missing mbstring:
apt-get install php7.x-mbstring
service apache2 restart
I recently had to do this for phpMyAdmin when upgrading PHP from 7.0 to 7.2 on Ubuntu 16.04 (Xenial Xerus).
In Ubuntu, you need to uncomment this line in file php.ini which is located at /etc/php/7.0/apache2/php.ini:
extension=php_mysqli.so
In case of docker after installing the mysqli as per Speedy's answer above docker-php-ext-install mysqli you should restart the the fpm as per this answer https://stackoverflow.com/a/43076457/932473
From inside container
kill -USR2 1
Let's use
mysqli_connect
instead of
mysql_connect
because mysql_connect isn't supported in PHP 7.

Cannot find php-curl package

I am struggling with the php-curl installation which cannot be found, I have seen plenty of topics related to it but it unfortunatelly did not help much. I want it for an curl function in a php program.
I tried it via adding ppa:ondrej/php repository, but I think it simply does not help much.
kali#kali$ sudo apt-get install php7.3
php7.3 php7.3-common php7.3-mysql php7.3-readline
php7.3-cli php7.3-json php7.3-opcache
kali#kali:$ sudo apt-get install php7.3-curl
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php7.3-curl
E: Couldn't find any package by glob 'php7.3-curl'
E: Couldn't find any package by regex 'php7.3-curl'
kali#kali:$ sudo apt-get install php7-curl
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php7-curl
$ sudo apt-get install php-curl
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php-curl
$ sudo add-apt-repository ppa:ondrej/php
Co-installable PHP versions: PHP 5.6, PHP 7.x and most requested extensions are included. Only Supported Versions of PHP (http://php.net/supported-versions.php) for Supported Ubuntu Releases (https://wiki.ubuntu.com/Releases) are provided. Don't ask for end-of-life PHP versions or Ubuntu release, they won't be provided.
Debian oldstable and stable packages are provided as well: https://deb.sury.org/#debian-dpa
You can get more information about the packages at https://deb.sury.org
IMPORTANT: The <foo>-backports is now required on older Ubuntu releases.
BUGS&FEATURES: This PPA now has a issue tracker:
https://deb.sury.org/#bug-reporting
CAVEATS:
1. If you are using php-gearman, you need to add ppa:ondrej/pkg-gearman
2. If you are using apache2, you are advised to add ppa:ondrej/apache2
3. If you are using nginx, you are advised to add ppa:ondrej/nginx-mainline
   or ppa:ondrej/nginx
PLEASE READ: If you like my work and want to give me a little motivation, please consider donating regularly: https://donate.sury.org/
WARNING: add-apt-repository is broken with non-UTF-8 locales, see
https://github.com/oerdnj/deb.sury.org/issues/56 for workaround:
# LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
More info: https://launchpad.net/~ondrej/+archive/ubuntu/php
Press [ENTER] to continue or ctrl-c to cancel adding it
gpg: keybox '/tmp/tmpfx71elke/pubring.gpg' created
gpg: /tmp/tmpfx71elke/trustdb.gpg: trustdb created
gpg: key 4F4EA0AAE5267A6C: public key "Launchpad PPA for Ondřej Surý" imported
gpg: Total number processed: 1
gpg: imported: 1
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
gpg: no valid OpenPGP data found.
$ sudo apt-get update
Ign:1 http://ppa.launchpad.net/ondrej/php/ubuntu hirsute InRelease
Hit:2 https://download.docker.com/linux/debian buster InRelease
Err:3 http://ppa.launchpad.net/ondrej/php/ubuntu hirsute Release
404 Not Found [IP: 91.189.95.85 80]
Hit:4 http://kali.koyanet.lv/kali kali-rolling InRelease
Hit:5 https://packages.gitlab.com/gitlab/gitlab-ce/debian jessie InRelease
Reading package lists... Done
E: The repository 'http://ppa.launchpad.net/ondrej/php/ubuntu hirsute Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
$ sudo apt-get install php
php7.3 php7.3-common php7.3-mysql php7.3-readline php-defaults
php7.3-cli php7.3-json php7.3-opcache php-common php-mysql
///// still cannot see curl module
More info about versions and system running it:
My php version is 7.3.12
kali#kali:$ php -v
PHP 7.3.12-1 (cli) (built: Nov 28 2019 07:34:08) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.12, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.12-1, Copyright (c) 1999-2018, by Zend Technologies
kali#kali:$ apt list --installed | grep php
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
libapache2-mod-php7.3/now 7.3.12-1 amd64 [installed,local]
libapache2-mod-php/now 2:7.3+69 all [installed,local]
php-common/now 2:69 all [installed,local]
php-mysql/now 2:7.3+69 all [installed,local]
php7.3-cli/now 7.3.12-1 amd64 [installed,local]
php7.3-common/now 7.3.12-1 amd64 [installed,local]
php7.3-json/now 7.3.12-1 amd64 [installed,local]
php7.3-mysql/now 7.3.12-1 amd64 [installed,local]
php7.3-opcache/now 7.3.12-1 amd64 [installed,local]
php7.3-readline/now 7.3.12-1 amd64 [installed,local]
php -m
[PHP Modules]
calendar
Core
ctype
date
exif
fileinfo
filter
ftp
gettext
hash
iconv
json
libxml
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
sockets
sodium
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
Zend OPcache
zlib
[Zend Modules]
Zend OPcache
Kali version
$ uname -irv
5.4.0-kali3-amd64 #1 SMP Debian 5.4.13-1kali1 (2020-01-20) unknown
sources
$ cat /etc/apt/sources.list | grep -v "#"
deb-src http://http.kali.org/kali kali-rolling main non-free contrib
I found there might have been some bugs
It was an issue with sources.list changed a lot time ago.
I updated it with other repositiories and it started working.
deb http://http.kali.org/kali kali-rolling main non-free contrib
deb https://http.kali.org/kali kali-rolling main contrib non-free
deb-src http://http.kali.org/kali kali-rolling main non-free contrib
deb-src https://http.kali.org/kali kali-rolling main contrib non-free
Next I have run sudo apt-get update.
Now I am able to see all the packages that were missing before.

PHP GD library is NOT installed but it has been enabled actually

I have PHP GD installed and enabled:
sudo gedit /etc/php/7.0/apache2/php.ini
;extension=php_bz2.dll
extension=php_curl.dll
;extension=php_fileinfo.dll
;extension=php_ftp.dll
extension=php_gd2.dll
But I cannot find it on the phpinfo(); screen, nor can I find it using the code below:
if (extension_loaded('gd') && function_exists('gd_info')) {
echo "PHP GD library is installed on your web server";
}
else {
echo "PHP GD library is NOT installed on your web server";
}
Result: PHP GD library is NOT installed on your web server
I am on PHP 7.0:
$ php -v
PHP 7.0.22-0ubuntu0.17.04.1 (cli) (built: Aug 8 2017 22:03:30) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.22-0ubuntu0.17.04.1, Copyright (c) 1999-2017, by Zend Technologies
Any idea why and how I can fix it?
I am on Kubuntu 17.10 btw
If I go ahead installing it again:
$ sudo apt-get install php7.0-gd
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package php7.0-gd is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'php7.0-gd' has no installation candidate
Why??
EDIT 1:
$ sudo apt-get install php-gd
Reading package lists... Done
Building dependency tree
Reading state information... Done
php-gd is already the newest version (1:7.1+54ubuntu1).
0 to upgrade, 0 to newly install, 0 to remove and 86 not to upgrade.
EDIT 2:
But there is something strange - I am on PHP 7.0 but the GD below is php7.1-gd,
$ sudo apt-cache search php7-*
libapache2-mod-php7.1 - server-side, HTML-embedded scripting language (Apache 2 module)
php-all-dev - package depending on all supported PHP development packages
php7.1 - server-side, HTML-embedded scripting language (metapackage)
php7.1-cgi - server-side, HTML-embedded scripting language (CGI binary)
php7.1-cli - command-line interpreter for the PHP scripting language
php7.1-common - documentation, examples and common module for PHP
php7.1-curl - CURL module for PHP
php7.1-dev - Files for PHP7.1 module development
php7.1-gd - GD module for PHP
php7.1-gmp - GMP module for PHP
php7.1-json - JSON module for PHP
php7.1-ldap - LDAP module for PHP
php7.1-mysql - MySQL module for PHP
php7.1-odbc - ODBC module for PHP
php7.1-opcache - Zend OpCache module for PHP
php7.1-pgsql - PostgreSQL module for PHP
php7.1-pspell - pspell module for PHP
php7.1-readline - readline module for PHP
php7.1-recode - recode module for PHP
php7.1-snmp - SNMP module for PHP
php7.1-sqlite3 - SQLite3 module for PHP
php7.1-tidy - tidy module for PHP
php7.1-xml - DOM, SimpleXML, WDDX, XML, and XSL module for PHP
php7.1-xmlrpc - XMLRPC-EPI module for PHP
libphp7.1-embed - HTML-embedded scripting language (Embedded SAPI library)
php-amqp - AMQP extension for PHP
php-apcu - APC User Cache for PHP
php-ds - PHP extension providing efficient data structures for PHP 7
php-gearman - PHP wrapper to libgearman
php-geoip - GeoIP module for PHP
php-gmagick - Provides a wrapper to the GraphicsMagick library
php-gnupg - PHP wrapper around the gpgme library
php-http - PECL HTTP module for PHP Extended HTTP Support
php-igbinary - igbinary PHP serializer
php-imagick - Provides a wrapper to the ImageMagick library
php-libsodium - PHP wrapper for the Sodium cryptographic library
php-mailparse - Email message manipulation for PHP
php-memcache - memcache extension module for PHP
php-memcached - memcached extension module for PHP, uses libmemcached
php-mongodb - MongoDB driver for PHP
php-msgpack - PHP extension for interfacing with MessagePack
php-oauth - OAuth 1.0 consumer and provider extension
php-pinba - Pinba module for PHP
php-propro - propro module for PHP
php-ps - ps module for PHP
php-radius - radius client library for PHP
php-raphf - raphf module for PHP
php-redis - PHP extension for interfacing with Redis
php-remctl - PECL module for Kerberos-authenticated command execution
php-rrd - PHP bindings to rrd tool system
php-sass - PHP bindings to libsass - fast, native Sass parsing in PHP
php-smbclient - PHP wrapper for libsmbclient
php-solr - PHP extension for communicating with Apache Solr server
php-ssh2 - Bindings for the libssh2 library
php-stomp - Streaming Text Oriented Messaging Protocol (STOMP) client module for PHP
php-symfony-polyfill-php70 - Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions
php-tideways - Tideways PHP Profiler Extension
php-uploadprogress - file upload progress tracking extension for PHP
php-uuid - PHP UUID extension
php-xdebug - Xdebug Module for PHP
php-yac - YAC (Yet Another Cache) for PHP
php-yaml - YAML-1.1 parser and emitter for PHP
php-zmq - ZeroMQ messaging bindings for PHP
php7.1-bcmath - Bcmath module for PHP
php7.1-bz2 - bzip2 module for PHP
php7.1-dba - DBA module for PHP
php7.1-enchant - Enchant module for PHP
php7.1-fpm - server-side, HTML-embedded scripting language (FPM-CGI binary)
php7.1-imap - IMAP module for PHP
php7.1-interbase - Interbase module for PHP
php7.1-intl - Internationalisation module for PHP
php7.1-mapi - Complete and feature rich groupware solution - PHP MAPI bindings
php7.1-mbstring - MBSTRING module for PHP
php7.1-mcrypt - libmcrypt module for PHP
php7.1-phpdbg - server-side, HTML-embedded scripting language (PHPDBG binary)
php7.1-soap - SOAP module for PHP
php7.1-sybase - Sybase module for PHP
php7.1-xsl - XSL module for PHP (dummy)
php7.1-zip - Zip module for PHP
php7cc - command line tool to detect PHP 7 incompatible code
php7.0-mysql - MySQL module for PHP
php7.0-readline - readline module for PHP
php7.0-opcache - Zend OpCache module for PHP
php7.0-mbstring - MBSTRING module for PHP
php7.0 - server-side, HTML-embedded scripting language (metapackage)
php7.0-cgi - server-side, HTML-embedded scripting language (CGI binary)
libapache2-mod-php7.0 - server-side, HTML-embedded scripting language (Apache 2 module)
php7.0-mcrypt - libmcrypt module for PHP
php7.0-curl - CURL module for PHP
php7.0-cli - command-line interpreter for the PHP scripting language
php7.0-fpm - server-side, HTML-embedded scripting language (FPM-CGI binary)
php7.0-xmlrpc - XMLRPC-EPI module for PHP
php7.0-json - JSON module for PHP
php7.0-common - documentation, examples and common module for PHP
php7.0-xml - DOM, SimpleXML, WDDX, XML, and XSL module for PHP
Is this causing the problem? Should I uninstall php7.1-gd?
I finally got it working following these 3 steps:
uninstalled PHP and all its libs from my machine following this answer.
upgraded Ubuntu to 18.04 following this guide.
installed PHP 7.2 following this guide.*
On my terminal:
$ sudo apt-get install php
$ sudo apt-get install php-pear php-fpm php-dev php-zip php-curl php-xmlrpc php-gd php-mysql php-mbstring php-xml libapache2-mod-php
$ php -v
PHP 7.2.5-0ubuntu0.18.04.1 (cli) (built: May 9 2018 17:21: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.5-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies
$ sudo systemctl restart apache2
Result:
It took a few hours but worth it!

Package 'php5-gd' has no installation candidate

"PHP module gd: Missing" I received such an error. and I'm trying to install php5-gd.
apt-get install php5-gd
I am using Ubuntu 16.10 and PHP version 7. I made all the updates.
When I tried to install php5-gd, I got an error like below.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package php5-gd is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'php5-gd' has no installation candidate
First check which php version you have by sudo php -v. I have php7 so the result is:
PHP 7.0.18-0ubuntu0.17.04.1 (cli) (built: Apr 26 2017 23:59:48) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.18-0ubuntu0.17.04.1, Copyright (c) 1999-2017, by Zend Technologies
since i have php7, I will do the following to list the php packages
sudo apt-cache search php7-*
this returned
libapache2-mod-php7.0 - server-side, HTML-embedded scripting language (Apache 2 module)
php-all-dev - package depending on all supported PHP development packages
php7.0 - server-side, HTML-embedded scripting language (metapackage)
php7.0-cgi - server-side, HTML-embedded scripting language (CGI binary)
php7.0-cli - command-line interpreter for the PHP scripting language
php7.0-common - documentation, examples and common module for PHP
php7.0-curl - CURL module for PHP
php7.0-dev - Files for PHP7.0 module development
php7.0-gd - GD module for PHP
php7.0-gmp - GMP module for PHP
php7.0-json - JSON module for PHP
php7.0-ldap - LDAP module for PHP
php7.0-mysql - MySQL module for PHP
php7.0-odbc - ODBC module for PHP
php7.0-opcache - Zend OpCache module for PHP
php7.0-pgsql - PostgreSQL module for PHP
php7.0-pspell - pspell module for PHP
php7.0-readline - readline module for PHP
php7.0-recode - recode module for PHP
php7.0-snmp - SNMP module for PHP
php7.0-sqlite3 - SQLite3 module for PHP
php7.0-tidy - tidy module for PHP
php7.0-xml - DOM, SimpleXML, WDDX, XML, and XSL module for PHP
php7.0-xmlrpc - XMLRPC-EPI module for PHP
libphp7.0-embed - HTML-embedded scripting language (Embedded SAPI library)
php-amqp - AMQP extension for PHP
php-apcu - APC User Cache for PHP
php-gearman - PHP wrapper to libgearman
php-geoip - GeoIP module for PHP
php-gmagick - Provides a wrapper to the GraphicsMagick library
php-gnupg - PHP wrapper around the gpgme library
php-http - PECL HTTP module for PHP Extended HTTP Support
php-igbinary - igbinary PHP serializer
php-imagick - Provides a wrapper to the ImageMagick library
php-libsodium - PHP wrapper for the Sodium cryptographic library
php-mailparse - Email message manipulation for PHP
php-memcache - memcache extension module for PHP
php-memcached - memcached extension module for PHP, uses libmemcached
php-mongodb - MongoDB driver for PHP
php-msgpack - PHP extension for interfacing with MessagePack
php-oauth - OAuth 1.0 consumer and provider extension
php-pinba - Pinba module for PHP
...and do on
now to install packages run the following command with your desired package
sudo apt-get install php7.0-mysql php7.0-gd php7.0-curl php7.0-recode
note:php7.0-mysql php7.0-gd php7.0-curl php7.0-recode are the package that are listed above.
UPDATE
dont forget to restart apache sudo service apache2 reload
You can use the meta-paclaget php-gd, which is an alias of php7.0-gd
sudo apt-get install php-gd
Please check php version and install modules
apt-get update
apt-get install php5.6-gd
If you want other modules then use this command to get all available modules
apt-cache search php5.*
you have php7 installed but you are trying to install a package of php5 that is the problem
Same issue here.
Use RUN rm /etc/apt/preferences.d/no-debian-php in dockerfile
Also you can see here the solution https://hub.docker.com/_/php

GD image library not loaded, Ubuntu 14.04

My Drupal installations are complaining over missing GD library:
GD library rotate and desaturate effects
The GD library for PHP is missing or outdated. Check the PHP image documentation for information on how to correct this.
However I have installed the gd package with
sudo apt-get install php5-gd
and restarted Apache several times.
It shows over the list of installed packages:
Packages:
dpkg -l|grep php
ii libapache2-mod-php5 5.5.9+dfsg-1ubuntu4.14 amd64 server-side, HTML-embedded scripting language (Apache 2 module)
ii php-pear 5.5.9+dfsg-1ubuntu4.14 all PEAR - PHP Extension and Application Repository
ii php5 5.5.9+dfsg-1ubuntu4.14 all server-side, HTML-embedded scripting language (metapackage)
ii php5-cgi 5.5.9+dfsg-1ubuntu4.14 amd64 server-side, HTML-embedded scripting language (CGI binary)
ii php5-cli 5.5.9+dfsg-1ubuntu4.14 amd64 command-line interpreter for the php5 scripting language
ii php5-common 5.5.9+dfsg-1ubuntu4.14 amd64 Common files for packages built from the php5 source
ii php5-gd 5.5.9+dfsg-1ubuntu4.14 amd64 GD module for php5
ii php5-json 1.3.2-2build1 amd64 JSON module for php5
ii php5-mysql 5.5.9+dfsg-1ubuntu4.14 amd64 MySQL module for php5
ii php5-readline 5.5.9+dfsg-1ubuntu4.14 amd64 Readline module for php5
When trying to add the library manually to a php.ini file with
extension=ge.so;
I get this warning:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20121212/ge.so' - /usr/lib/php5/20121212/ge.so: cannot open shared object file: No such file or directory in Unknown on line 0
Server has been installed with Virtualmin GPL
Ubuntu 14.04.3 LTS
PHP version:
PHP 5.5.9-1ubuntu4.14
Any advice very appreciated!

Categories