gnope php gtk gui gnope.org  

problem connecting to Mysql

 
Post new topic   Reply to topic    gnope.org Forum Index -> PHP GTK2 Beginners
View previous topic :: View next topic  
Author Message
weeda



Joined: 12 Jun 2006
Posts: 10

PostPosted: Mon Jun 12, 2006 6:01 pm    Post subject: problem connecting to Mysql Reply with quote

Hi all,
i am a beginner in GTK PHP and i have problem connecting to MySQL 5.0.18.
I am using GTK-PHP2 with PHP5. I use @mysql_connect, so i cant see the error message. But if I use just mysql_connect, then i got the following error message: Fatal:error: Call to undefined function mysql_connect() in XXX on line XXX .
With PHP5 (classic, no GTK), the connection is working, so I have no idea what's the problem.
Thanks in advance,
Andi
Back to top
cweiske



Joined: 08 Dec 2005
Posts: 454
Location: Leipzig/Germany

PostPosted: Mon Jun 12, 2006 6:26 pm    Post subject: Reply with quote

I guess the mysql extension isn't loaded. Look into the php.ini.
It's in C:\PHP-Gtk2\php.ini
Back to top
weeda



Joined: 12 Jun 2006
Posts: 10

PostPosted: Mon Jun 12, 2006 6:58 pm    Post subject: Reply with quote

Thanks for the quick answer.
The extesnsion php_mysql.dll is loaded. I need something else?
Back to top
cweiske



Joined: 08 Dec 2005
Posts: 454
Location: Leipzig/Germany

PostPosted: Mon Jun 12, 2006 7:01 pm    Post subject: Reply with quote

Are you sure? Am I right that you have two php versions on your computer, one for php-gtk2 and one for the webserver?

To check if it is really there, you can use
Code:
var_dump(get_loaded_extensions());

and run it from command line with the php-gtk2 php
Back to top
weeda



Joined: 12 Jun 2006
Posts: 10

PostPosted: Mon Jun 12, 2006 7:42 pm    Post subject: Reply with quote

I have 3 PHP installed. One PHP4 (i am not using this), PHP5 for the webserver and one PHP5 for GTK. And i am using the php frpm the GTK.
Hmm... you have right the mysql extension is not loaded...how can i loaded it? the extension=php_mysql.dll is in the php.ini. I have to do something else?
Back to top
cweiske



Joined: 08 Dec 2005
Posts: 454
Location: Leipzig/Germany

PostPosted: Mon Jun 12, 2006 7:43 pm    Post subject: Reply with quote

Do you have a php.ini in your windows (or windows system) directory? if yes, please move it to the apache php installation.

But you don't have a semicolon in front of the "extension" -> ";extension=..."? If yes, remove it.
Back to top
leon_pegg



Joined: 12 Jun 2006
Posts: 113
Location: hemel / UK

PostPosted: Mon Jun 12, 2006 7:45 pm    Post subject: Reply with quote

try running from the command line like this
c:\phpgtk2\php.exe -c c:\phpgtk2\php.ini c:\phpgtk2\myprograms\test.php

this ensures that the corect php.ini is used if not it will default to the c:\windows\php.ini

regrads leon pegg
Back to top
weeda



Joined: 12 Jun 2006
Posts: 10

PostPosted: Mon Jun 12, 2006 8:17 pm    Post subject: Reply with quote

I don't have a semicolon in front of the extension.
The PHP is using the php.ini from the c:/windows/ directory.
Back to top
cweiske



Joined: 08 Dec 2005
Posts: 454
Location: Leipzig/Germany

PostPosted: Mon Jun 12, 2006 8:48 pm    Post subject: Reply with quote

That's the problem: There are two php.ini files on your system.

Your webserver php uses the one in the windows dir, while the php-gtk one *should* use the one in C:\php-gtk2\. Apparently, it uses the one in the windows dir which fails.

So move the one from the windows dir to the apache/whatever directory, so that only the webserver php sees it. That should fix it for php-gtk2.
Back to top
weeda



Joined: 12 Jun 2006
Posts: 10

PostPosted: Mon Jun 12, 2006 10:01 pm    Post subject: Reply with quote

should i use a specific port for mysql_connect at the "mysql.default_port =" or what's the procedure here ?
Back to top
weeda



Joined: 12 Jun 2006
Posts: 10

PostPosted: Mon Jun 12, 2006 10:27 pm    Post subject: Reply with quote

It's working Very Happy

Thanks for the help...
Back to top
Display posts from previous:   
Post new topic   Reply to topic    gnope.org Forum Index -> PHP GTK2 Beginners All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Templates enhanced by DigiWiki. Hosting by Tradebit.