How to enabled GD in PHP 5.2.0?

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
phpwalker
Forum Commoner
Posts: 81
Joined: Sun Apr 23, 2006 12:18 pm

How to enabled GD in PHP 5.2.0?

Post by phpwalker »

I've installed the following:

Windows XP
PHP 5.2.X
Apache 2.2.X

I don't know where to check the GD enable or not. I've been searching through the phpinfo() but couldn't find any of GD related infor.

Anyone could tell me how to enable or install the GD on window machine? Thanks a lot if anyone could tell me.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Uncomment the php_gd2.dll line in the extensions section of the php.ini.
phpwalker
Forum Commoner
Posts: 81
Joined: Sun Apr 23, 2006 12:18 pm

Post by phpwalker »

Yup, I've uncommented it, restart the Apache and it still not working.

Actually I'm installing phpbb3 beta Forum, it shows that I don't have the GD support (for visual confirmation), so I'm trying to get that enabled.

In the phpinfo(), I couldn't find a thing showing GD 2.0 there.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Are you sure you've edited the correct php.ini?

Code: Select all

<?php

echo get_cfg_var('cfg_file_path');

?>
phpwalker
Forum Commoner
Posts: 81
Joined: Sun Apr 23, 2006 12:18 pm

Post by phpwalker »

Yes, it's in the correct path which is in
C:\Program Files\PHP\php.ini
Strange, how do we check if the GD is enable? Any simple code can let me try it out?
The PHPBB3 board keep saying that GD is not available. *sigh*
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

The following will list all extensions that are loaded.

Code: Select all

<?php

$cli = (php_sapi_name() == 'cli');
$eol = "\n";

$gle = get_loaded_extensions();
$rows = array();
$le = '';
$wide = 4;
$j = count($gle);
$pad = $wide - $j % $wide;
$len = max(array_map('strlen', $gle));
$func = create_function('$a', 'return str_pad($a, ' . intval($len) . ');');
$gle = array_map($func, $gle);
for($i = 0; $i < $j; $i += $wide)
{
	$le .= '   ' . implode('   ', array_slice($gle, $i, $wide)) . $eol;
}

if (!$cli)
{
	echo '<html><head><title>quick info</title></head><body><pre>', $eol;
}

echo 'Loaded Extensions:', $eol, $le, $eol;

if (!$cli)
{
	echo '</pre></body></html>', $eol;
}

?>
phpwalker
Forum Commoner
Posts: 81
Joined: Sun Apr 23, 2006 12:18 pm

Post by phpwalker »

Loaded Extensions:
bcmath calendar com_dotnet ctype
session filter ftp hash
iconv json odbc pcre
Reflection date libxml standard
tokenizer zlib SimpleXML dom
SPL wddx xml xmlreader
xmlwriter apache2handler mysql mysqli
pop3
This is what it shows. I've done more things this time, I search in the ext folder of the php root, it doesn't have php_gd2..dll, so I downloaded the PHP 4.x.x binary zip file and get the php_gd2.dll from it's extension. I copy and moved it into my PHP ext folder.

Restart Apahce. Nothing happen as well. =.="

What's going on. I check and check the extension=php_gd2.dll has been uncommented, the extension_dir is pointing to the correct path which is the C:/Program Files/PHP/ext.

What's wrong with my PHP GD?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

please try

Code: Select all

<?php
error_reporting(E_ALL);
ini_set('display_errors', true);

echo 'version: ', phpversion(), "<br />\n";
echo 'uname: ', php_uname('srv m'), "<br />\n";

$ini = get_cfg_var('cfg_file_path') or die('no config file');
echo 'ini: ', $ini, "<br />\n";
foreach(file($ini) as $l) {
	if ( false!==strpos($l, 'php_gd')) {
		echo 'gd: ', trim($l), "<br />\n";
	}
}

$ext = get_cfg_var('extension_dir');
echo 'extdir: ', $ext, "<br />\n";
foreach( glob($ext.'/php_gd*') as $f) {
	echo 'php_gd: ', $f, "<br />\n";
}

foreach( get_loaded_extensions() as $e ) {
	if ( false!==strpos($e, 'gd')) {
		echo 'extension: ', trim($e), "<br />\n";
	}
}
and post the output
Post Reply