Fatal error: Call to undefined function mysql_connect()
Moderator: General Moderators
-
applening56
- Forum Newbie
- Posts: 4
- Joined: Wed Dec 10, 2008 4:17 pm
Fatal error: Call to undefined function mysql_connect()
Fatal error: Call to undefined function mysql_connect()
above is the error i got when i tried to run this code:
<?php
mysql_connect("localhost", "root", "root") or die(mysql_error());
echo mysql_error();
echo "Connected to MySQL<br />";
mysql_select_db("test") or die(mysql_error());
echo "Connected to Database";
?>
i'm new to php and just installed php 5.2.8 and apache 2.2 on vista home premium (i had MySQL5.0 installed before)
it seems php cannot talk to MySQL. i don't see any information about MySQL when i run phpinfo()
i copied php_mysql.dll to c:\program files\php\ext and set the extension_dir as the same in php.ini. i also have php_mysql.dll and libmysql.dll in system32 folder.
i've been playing around with php.ini for a while and i'm running out of options now. does anybody have an idea what the problem might be?? help!
thanks in advance!
above is the error i got when i tried to run this code:
<?php
mysql_connect("localhost", "root", "root") or die(mysql_error());
echo mysql_error();
echo "Connected to MySQL<br />";
mysql_select_db("test") or die(mysql_error());
echo "Connected to Database";
?>
i'm new to php and just installed php 5.2.8 and apache 2.2 on vista home premium (i had MySQL5.0 installed before)
it seems php cannot talk to MySQL. i don't see any information about MySQL when i run phpinfo()
i copied php_mysql.dll to c:\program files\php\ext and set the extension_dir as the same in php.ini. i also have php_mysql.dll and libmysql.dll in system32 folder.
i've been playing around with php.ini for a while and i'm running out of options now. does anybody have an idea what the problem might be?? help!
thanks in advance!
- novice4eva
- Forum Contributor
- Posts: 327
- Joined: Thu Mar 29, 2007 3:48 am
- Location: Nepal
Re: Fatal error: Call to undefined function mysql_connect()
If it looks like this in php.ini
change it so it looks like
and rerun the services, phpinfo must show mysql thing somewhere
Code: Select all
;extension=php_mysql.dll
Code: Select all
extension=php_mysql.dll
-
applening56
- Forum Newbie
- Posts: 4
- Joined: Wed Dec 10, 2008 4:17 pm
Re: Fatal error: Call to undefined function mysql_connect()
thanks for your reply!
but i had uncommented the line and it wasn't working.
i've given up on php5 and installed php4. it's working fine now.
but i had uncommented the line and it wasn't working.
i've given up on php5 and installed php4. it's working fine now.
Re: Fatal error: Call to undefined function mysql_connect()
Following this logic, do you uninstall windows XP and install windows 3.11 every time a program isn't working?i've given up on php5 and installed php4. it's working fine now.
Going back to PHP 4 is a major regression. It is no longer officially supported and misses many advanced features introduced in PHP 5.
-
applening56
- Forum Newbie
- Posts: 4
- Joined: Wed Dec 10, 2008 4:17 pm
Re: Fatal error: Call to undefined function mysql_connect()
I know it's not the best solution. I wouldn't have done that if I had other options. I had read a number of threads related to this topic and tried every possible solution people suggested, but it just didn't work.pytrin wrote:Following this logic, do you uninstall windows XP and install windows 3.11 every time a program isn't working?i've given up on php5 and installed php4. it's working fine now.
Going back to PHP 4 is a major regression. It is no longer officially supported and misses many advanced features introduced in PHP 5.
I just didn't know what else to do. Since it's a testing machine I'm using, I just got it to work with the application I plan to test and didn't want to waste more time on it. The actual server I'm gonna use already has PHP5 and MySQL so I don't have to worry about that.
But it would be greatly appreciated if you would share your thought on what might be the problem. It kinda bothers me.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: Fatal error: Call to undefined function mysql_connect()
Did you restart apache after making the changes to your php.ini?
Did you check your error logs?
I agree with the others, reverting back to PHP4 not the best decision
Did you check your error logs?
I agree with the others, reverting back to PHP4 not the best decision
-
applening56
- Forum Newbie
- Posts: 4
- Joined: Wed Dec 10, 2008 4:17 pm
Re: Fatal error: Call to undefined function mysql_connect()
Jcart wrote:Did you restart apache after making the changes to your php.ini?
Did you check your error logs?
I agree with the others, reverting back to PHP4 not the best decision
I did restart every time made changes. Where do I find the error log?
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: Fatal error: Call to undefined function mysql_connect()
Typically there is a "logs" dir within apache dir. I.e, in my install it would be \apache\logs\error.log
This more than likely will tell you what is happening when trying to load the module.
This more than likely will tell you what is happening when trying to load the module.