Page 1 of 2

GD and Xampp?

PostPosted: 24. February 2009 12:10
by bluejie
Hi, I've been working on a script involving GD. I found that you first need a GD Library or something. I asked my friend and he gave me a script:

Code: Select all
<?php
print_r(gd_info());
?>


It should give information about your GD, but it doesn't give anything. I searched for it in these forums and found out that I should start Apache, go to http://localhost/xampp/phpinfo.php and then look for section GD.Well, I can't find a GD section.
How can I activate the GD? I also read thing about a file called 'php_gd2.dll' and the php.ini. Does that have anything to do with this or not?

I hope you can help me,
Bluejie

Re: GD and Xampp?

PostPosted: 24. February 2009 12:19
by Izzy
What version of XAMPP?

GD is activated by default in 1.7.0

Check in xampp\apache\bin\php.ini for this line and make sure it is uncommented and should look like this:
extension=php_gd2.dll

Then look again in the phpinfo.php for the GD section - the sections are in alphabetical order.

Re: GD and Xampp?

PostPosted: 24. February 2009 12:34
by bluejie
This is how it looks like in the php.ini

Code: Select all
;extension=php_fileinfo.dll
;extension=php_filepro.dll
;extension=php_filter.dll
;extension=php_fribidi.dll
extension=php_gd2.dll
extension=php_gettext.dll
;extension=php_gmp.dll
;extension=php_gopher.dll
;extension=php_hash.dll


And the phpinfo.php:
http://img519.imageshack.us/img519/1808/79506514.jpg

As you can see, no GD

Re: GD and Xampp?

PostPosted: 24. February 2009 12:39
by Izzy
Look for this line in the php.ini file and what does it have next to it?
Loaded Configuration File

Re: GD and Xampp?

PostPosted: 24. February 2009 12:44
by bluejie
I searched for it, but the ini can't find it. I've searched for Configuration File and it found 2 things:

Code: Select all
; open_basedir, if set, limits all file operations to the defined directory
; and below.  This directive makes most sense if used in a per-directory
; or per-virtualhost web server configuration file. This directive is
; *NOT* affected by whether Safe Mode is turned On or Off.
;open_basedir =

and
Code: Select all
[Tidy]
; The path to a default tidy configuration file to use when using tidy
;tidy.default_config = /usr/local/lib/php/default.tcfg


But I think both of them aren't the one...

Re: GD and Xampp?

PostPosted: 24. February 2009 12:47
by Izzy
Sorry typo - look in http://localhost/xampp/phpinfo.php for the line:
Loaded Configuration File and let me know what it has next to it.

Re: GD and Xampp?

PostPosted: 24. February 2009 12:51
by bluejie
Code: Select all
D:\School\Programeren\PHP\php.ini


That's weird...
mm, the directory Xampp is in the map Program.
So for Xamp the local address is:
Code: Select all
D:\School\Programeren\Xampp

Re: GD and Xampp?

PostPosted: 24. February 2009 12:55
by Izzy
bluejie wrote:
Code: Select all
D:\School\Programeren\PHP\php.ini


That's weird...
mm, the directory Xampp is in the map Program.
So for Xamp the local address is:
Code: Select all
D:\School\Programeren\Xampp
Then you must find the php.ini file in the other directory and rename it, as the php.ini file used by xampp is in the xampp\apache\bin folder.

You may have a path set in the Environment Variables to the other php.ini file which should be removed by editing the path variable or simply delete the other PHP instance.

Re: GD and Xampp?

PostPosted: 24. February 2009 13:05
by bluejie
Then you must find the php.ini file in the other directory and rename it, as the php.ini file used by xampp is in the xampp\apache\bin folder.

You may have a path set in the Environment Variables to the other php.ini file which should be removed by editing the path variable or simply delete the other PHP instance.


I can't really follow that one... With the other directory, you mean the one which is now my loaded configuration file? And where are the Environment Variables?

Re: GD and Xampp?

PostPosted: 24. February 2009 13:13
by Izzy
Either rename this file:
D:\School\Programeren\PHP\php.ini
to php.ini.bak
Or delete the whole PHP folder as you already have a PHP in XAMPP.


Windows Control Panel>System>Advanced>Environment Variables>System variables>path
Look for any php.ini file and delete it from the path.

If you are not confident to do that then the rename or the delete above will be fine.

Restart Apache when you have completed the task.

Re: GD and Xampp?

PostPosted: 24. February 2009 13:26
by bluejie
Ok, I deleted the PHP-directory and the Path
http://img93.imageshack.us/img93/3466/gd2.jpg
As you can see, no path

Now it gives error when I start Apache. It says it can't find "php4ts.dll". Though the server is still working (as I can still view the phpinfo.php)
The Loaded Configuration File is showing correct now: D:\School\Programeren\Xampp\apache\bin\php.ini
But still there's no GD section ("Gettext" has appeared between "ftp" and "hash")

So I've got an error now when I start Apache and the GD section isn't there

Re: GD and Xampp?

PostPosted: 24. February 2009 13:45
by Izzy
I have no way of knowing what else you have changed since you installed XAMPP and what I asked you to do is a very simple fix for your issue - Apache uses the php.ini file in the apache\bin folder and that is all that you have fixed which has not caused your new problems, the problems you now have are caused by something else.

Again what version of XAMPP?

Any clues in the apache\logs\error.log file?

What else have you been changing that you may not understand?

Try reboot your PC and then try again and see if you get the error message.

You are on Vista - is the UAC disabled and are you logged in as an administrator?

Re: GD and Xampp?

PostPosted: 24. February 2009 13:50
by bluejie
well I've copied and pasted an ini file of xampp, but I can't remember which one. I also found an ini file on Xampp/php/php.ini
So I might have copied that to bin, but im not sure. Is there any way of getting a new ini file?

Re: GD and Xampp?

PostPosted: 24. February 2009 14:03
by Izzy
bluejie wrote:well I've copied and pasted an ini file of xampp, but I can't remember which one. I also found an ini file on Xampp/php/php.ini
So I might have copied that to bin, but im not sure. Is there any way of getting a new ini file?
Well now we have found the problem and there is not much you can do if you lost the original php.ini file and still you have not told me the XAMPP version.

Best to uninstall XAMPP as per the xampp\readme_en.txt file and download and do a fresh install - make sure that all XAMPP components are stopped and uninstall any running as a service before deleting the xampp folder or you will have more issues after your fresh install.

Don't try and install again into the existing xampp folder, it has to be deleted when all components are stopped.

Please follow the installation instructions for your fresh install and backup or copy your own files from the htdocs folder so you can replace them when the install is finished.

The lesson here is don't do anything in XAMPP unless you understand fully the consequences and always make backup copies before deleting or changing any conf or ini file so if you get issues like this then you can easily revert.

Re: GD and Xampp?

PostPosted: 24. February 2009 14:09
by bluejie
Well, I reïnstalled my Xampp version 1.7.0 now it's working!

Thank you very much for your quick responses and help! I'm very gratefull!