Install library GD

franjgg

New Member
Joined
Mar 12, 2024
Messages
4
Reaction score
0
Credits
40
Hello,

Well, I'm trying to install the GD library to convert images from PHP, the thing is that I have tried several ways and nothing.

I have Ubuntu 16.04 with PHP 7.4.13, so I don't have much knowledge with bash.

I have tried to install it this way:

sudo apt-get update
sudo apt-get install php7.4-gd
sudo systemctl restart apache2
apache2 service restart

I get this response:

unable to locate package php7.4-gd
couldn't find any package by glog
couldn't find any package by regex

I read that I should update the repository or add the appropriate one, and I tried:

sudo apt-add-repository ppandrej/php
sudo apt-get update
sudo apt-get install -y php7.4-gd

But yes with the same result.

He also tried installing the php7.0-gd version but nothing.

Let's see if someone can guide me a little, I have done everything from a vnc connection and being root.
 

Attachments

  • gd.jpg
    gd.jpg
    202.2 KB · Views: 51


I have Ubuntu 16.04 with PHP 7.4.13,
and here's why
Ubuntu 16.04 End of Life (EOL) is scheduled for April 30, 2021. Make sure to prepare in advance by upgrading or migrating servers running on Ubuntu 16.04 systems.
 
Thanks for your answer,

In that case, what would be the solution to be able to use the gd library?
Would I need to update Ubuntu to a more current version?
The problem is that I have several websites and we are afraid that they will stop working and that the server will not update correctly.
 
The library is probably called something like php-gd.
Try using apt search php-gd —-names-only to search for the correct package name.
Then when you have the correct package name, install it with apt.
E.g.
sudo apt install php-gd
 
Thank you for your response, I have done the search and it shows me the following information.
As it says, it is installed but the php.ini is not displayed and gd does not work in php.

gd.jpg
 
Thank you for your response, I have done the search and it shows me the following information.
As it says, it is installed but the php.ini is not displayed and gd does not work in php.

View attachment 18805
FYI - in the above you mis-typed the —-names-only parameter to apt search. There are supposed to be two - characters at the start of —-names-only. You only used one.

Also, yes - you are correct, you appear to have the gd module installed. So you should be able to include it and use it in your php scripts.

In what way are you unable to use it?
How is the module failing?
E.g. Are you getting error messages from php when you try to include and use the module? Or is it just failing to process images?

It could either be a problem with your script, or perhaps you don’t have the image tools it uses installed.
I believe that the gd library uses external tools like imagemagick to process images. So do you have the relevant tools installed alongside the gd library? If not, that would explain the problem.
 
The problem is that it doesn't give any errors when you run the php code in the browser and I know that the code is correct because you tested it on another server with GD active.

Also in the php.ini file, the GD section does not appear as if it appears on my other server, as seen in the image.

To provide some more information, I am using Ubuntu 16.04 with PHP 7.4.13.

I don't know if I have imagemagick installed, I thought they were independent.
 

Attachments

  • gd.jpg
    gd.jpg
    207.1 KB · Views: 67

Staff online


Top