You are not logged in.

#1 2014-11-25 18:34:57

Sulice
Member
Registered: 2013-10-22
Posts: 18

[SOLVED] php-gd not working

Hello guys,

I have a problem with php-gd. I installed it, uncommented the "extension=gd.so" line in the php.ini file and it appeared in the php infos (with php_info()). At that time I was still happy smile
But to my stupefaction imagecreatejpeg and getimagesize seem to be not working : they return bool(false) all the time.
I don't understand the problem since gd_info() is working, gd must be loaded properly.

-> I have libpng, freetype2 and libjpeg-turbo, the right set of permission over the file gd.so (755 root:root) and the extension_dir (from php.ini) is correct.

I don't know what to look next...

Anyone knows better ?

Last edited by Sulice (2014-11-26 11:43:26)

Offline

#2 2014-11-25 19:51:14

Spider.007
Member
Registered: 2004-06-20
Posts: 1,175

Re: [SOLVED] php-gd not working

What happens if you do

<?php
error_reporting(-1);
ini_set('display_errors', 'On');
getimagesize($file);

Offline

#3 2014-11-26 06:35:41

Sulice
Member
Registered: 2013-10-22
Posts: 18

Re: [SOLVED] php-gd not working

Okay, here is the code :

<?php
  error_reporting(-1);
  ini_set('display_errors', 'On');
  $arr_img = getimagesize("http://i.imgur.com/OupnMlU.jpg");
  var_dump($arr_img);
  $im = imagecreatefromjpeg("http://i.imgur.com/OupnMlU.jpg");
  var_dump($im);
  imagedestroy($im);
 ?>

And here is the output :

Warning: getimagesize(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /srv/http/test.php on line 4

Warning: getimagesize(http://i.imgur.com/OupnMlU.jpg): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /srv/http/test.php on line 4
bool(false)
Warning: imagecreatefromjpeg(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /srv/http/test.php on line 6

Warning: imagecreatefromjpeg(http://i.imgur.com/OupnMlU.jpg): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /srv/http/test.php on line 6
bool(false)
Warning: imagedestroy() expects parameter 1 to be resource, boolean given in /srv/http/test.php on line 8

Offline

#4 2014-11-26 07:10:30

ackt1c
Banned
From: Visalia, California
Registered: 2012-10-10
Posts: 241

Re: [SOLVED] php-gd not working

b

Last edited by ackt1c (2022-11-05 13:36:46)

Offline

#5 2014-11-26 07:21:28

Sulice
Member
Registered: 2013-10-22
Posts: 18

Re: [SOLVED] php-gd not working

I can visit the link. By fail do you mean that gd cannot access it ? (I checked an the fopen option for urls was on in my php.ini)
I need to work with urls and not images on my computer.

I'll try imagick this evening. (In 9h for me)

Offline

#6 2014-11-26 07:27:40

ackt1c
Banned
From: Visalia, California
Registered: 2012-10-10
Posts: 241

Re: [SOLVED] php-gd not working

For

Last edited by ackt1c (2022-11-05 13:36:15)

Offline

#7 2014-11-26 11:43:08

Sulice
Member
Registered: 2013-10-22
Posts: 18

Re: [SOLVED] php-gd not working

I quickly installed imagick, restarted apache and gd started working.
Dunno what happened... Is a reboot not like a restart for apache ?

I shall give a try to imagick but anyhow, the problem is solved.

Thanks !

Offline

Board footer

Powered by FluxBB