Page 1 of 1
How to enabled GD in PHP 5.2.0?
Posted: Wed Feb 07, 2007 11:48 am
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.
Posted: Wed Feb 07, 2007 1:51 pm
by feyd
Uncomment the php_gd2.dll line in the extensions section of the php.ini.
Posted: Thu Feb 08, 2007 3:14 am
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.
Posted: Thu Feb 08, 2007 9:11 am
by feyd
Are you sure you've edited the correct php.ini?
Code: Select all
<?php
echo get_cfg_var('cfg_file_path');
?>
Posted: Thu Feb 08, 2007 3:20 pm
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*
Posted: Thu Feb 08, 2007 4:26 pm
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;
}
?>
Posted: Fri Feb 09, 2007 1:46 am
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?
Posted: Sat Feb 10, 2007 2:37 am
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