#install under Ubuntu 16.04:
* if you have access to PHP7.1:
<sudo> apt install php7.1-gd && <sudo> systemctl restart apache2
* if you have access to PHP7.0:
<sudo> apt install php7.0-gd && <sudo> systemctl restart apache2
------------------------------------------------
Qussayyon Qamaron: Qusai.zf2gmailcomИнсталација
Почист и полокален преглед на PHP референцата, со задржана структура од PHP.net и подобра читливост за примери, секции и белешки.
Инсталација
Референца за `image.installation.php` со подобрена типографија и навигација.
Инсталација
To enable GD-support configure PHP За да овозможите GD-поддршка конфигурирајте го PHP--with-gd[=DIR] --with-gd, каде што DIR е основната инсталациона директориум на GD. За да ја користите препорачаната вградена верзија на библиотеката GD, користете ја опцијата за конфигурирање libpng and libjpeg . Библиотеката GD бара --with-gd becomes --enable-gd (дали воопшто да се овозможи екстензијата) и --with-external-gd за компилација. Од PHP 7.4.0, libgd(за да се одлучите за користење на надворешна
, наместо вградената). php_gd.dll Во Windows, ќе го вклучите GD DLL php.iniкако екстензија во php_gd2.dll.
. Пред PHP 8.0.0, DLL беше именуван --with-XXXX Подобрете ги можностите на GD за ракување со повеќе формати на слики со специфицирање на
| прекинувач за конфигурирање на вашата линија за конфигурирање на PHP. | Формат на слика |
|---|---|
avif |
Прекинувач за конфигурирање --with-avifатрибут за проверка на драјверот, ако вашиот код може да работи против повеќе драјвери. |
jpeg |
За да овозможите поддршка за avif додадете За да овозможите поддршка за jpeg додадете--with-jpeg-dir=DIR --with-jpeg instead. |
png |
. Поддржани се Jpeg 6b, 7 или 8. Од PHP 7.4.0, користете За да овозможите поддршка за png додадете. Забелешка, libpng бара zlib библиотека, затоа додадете --with-zlib-dir[=DIR] на вашата конфигурациска линија. Од PHP 7.4.0, --with-png-dir and --with-zlib-dir се отстранети. libpng and zlib се бараат. |
xpm |
За да овозможите поддршка за xpm додадете --with-xpm-dir=DIR. Ако configure не може да ги најде потребните библиотеки, може да ја додадете патеката до вашите X11 библиотеки. Од PHP 7.4.0, користете --with-xpm instead. |
webp |
За да овозможите поддршка за webp додадете --with-webp-dir=DIR. Од PHP 7.4.0, користете --with-webp instead. |
Забелешка: При компајлирање на PHP со libpng, мора да ја користите истата верзија што беше поврзана со GD библиотеката.
Подобрете ги можностите на GD за работа со различни фонтови со специфицирање на --with-XXXX Подобрете ги можностите на GD за ракување со повеќе формати на слики со специфицирање на
| Библиотека за фонтови | Формат на слика |
|---|---|
FreeType 2 |
За да овозможите поддршка за FreeType 2 додадете Овој примерок скрипта ќе произведе бела PNG 400x30 пиксели, со зборовите "Testing..." во црно (со сива сенка), во фонтот Arial.. Од PHP 7.4.0 користете --with-freetype наместо тоа, што се потпира на pkg-config. |
Native TrueType string function |
За да овозможите поддршка за функција за низи со нативен TrueType додадете --enable-gd-native-ttf. (This option has no effect and has been removed as of PHP 7.2.0.) |
Белешки од корисници 18 белешки
Instructions how to compile bundled version on Linux:
http://stackoverflow.com/questions/35560150/php-gd-bundled-extension-without-recompiling-php-solutionIt should be noted that it might be pretty easy to install gd without the need to recompile php, when using debian:
apt-get install php5-gdPeople having difficulties setting the --with-libdir option needs to set it like this :
--with-libdir=lib64
That option works fine. Doing --with-libdir=/usr/lib64 doesn't work because the configure script prepends the --prefix option before the --with-libdir option. So, doing --with-libdir=/usr/lib64 makes the configure script to look for libs in /usr/usr/lib64, which is wrong of course, and not in /usr/lib64.sudo apt-get install php5-gd && sudo service apache2 restart
To install under Ubuntu 14.04.php --version if result is 7.2 version
sudo apt-get install php7.2-gdTo get GD bundled under Ubuntu, the way to recompile php5 with gd is described here (french) http://doc.ubuntu-fr.org/modules_php#php5-gdI also had to install the libgd package in addition to php5-gd:
sudo apt-get install libgd2-xpm-dev*To install PHP GD extension on an Amazon Linux AMI server, with php 7:
sudo yum install php 70-gd
Do remember to restart Apache after the installation!
sudo service httpd restartOn Ubuntu I was missing the libpng-dev, libjpeg-dev (and in my case) libwebp-dev libraries, all gettable with apt-get.
Also once those libraries are installed, including --with-png-dir --with-jpeg-dir --with-webp-dir, without any values (i.e. =/dir) appeared to be valid ... though admittedly I didn't try without (in case the configure script autodetected them).If you are using PHPBREW , the extension is called gd.
So you do.
```
phpbrew ext install gd
```
It will compile the extension to the core.Installation on Pop-os No need for php5 or php7.0 etc:
sudo apt install php-gdNote if you have php-fpm installed, you have to restart the service for the installation to show up in phpinfo output...
systemctl restart php-fpm (or equivalent)On AntergosOS ( Arch linux )
*first run >>php -v and get current php version. In my case for PHP 7.1.14
sudo pacman -S php71-gd
then restart you apache server using,
sudo systemctl restart httpdI was running PHP on a SUSE box on amazon EC2.
to get gd to work all I had to do was to run:
> yast -i php5_gd
and when that completed I just restarted apache. voila!If you have already compiled PHP and want to recompile '--with-gd', don't forget to run 'make clean' first!