Jump to content


Photo

Call To Undefinded Function mysql_connect


  • This topic is locked This topic is locked
43 replies to this topic

#1 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 02 March 2006 - 03:06 PM

The post has been moved to the FAQ/Code Snippet Repository forum. Click here to continue. If you have any questions or problems please post  them in this thread.

#2 Pche

Pche
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 04 March 2006 - 06:28 PM

Hello,
when I installed php 5.1.2 in apache2 (and also in apache1.3, both on win 2000) I did steps you described. I would like to run gd2 and mysql extensions so I uncomment:
extension=php_gd2.dll
extension=php_mysql.dll

Now, when I starting apache2 (apache1.3 too), gd2 extension is running well, but when starting mysql extension there is error:

Entering point mysql_real_espace_string procedure wasn't able to be found in dynamical joined libraryLIBMYSQL

After this error message apache write "couldn't load module c:\www\php\ext\pmp_mysql.dll" so I can't use mysql.

Do you know how to do it? Can you help me please?


#3 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 05 March 2006 - 12:32 PM

Okay what did you use to install PHP? If you used the installer thenm you need to download the zipped binaries from php.net and overite the all the files that installer installed with whats contained in the zipped file. I ahve a feeling you may have incompatibal .dll files.

#4 winthrup7

winthrup7
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 17 March 2006 - 10:43 AM

Hello, I did all the following (checked it twice), but still have not been able to enable mysql support.

Php works fine (phpinfo has no mysql information, and I get the mysql_connect() undefined error.
Using Apache 2.0.55; Php 5.12; MySql server 5.0 WinXP (Home);

Php.ini has the correct extension_dir:
extension_dir ="c:\php\ext"

php.ini has extension enabled:
extension=php_mysql.dll

libmysql.dll has been moved to C:\Windows (in the path)

In addition, I added c:\php to the Path.

Can someone help? I installed php as a module. I initially used the installer, but wanted to use the module; so I removed the php folder completely, and then replaced them with .zip install files. php works fine, and I get no errors in Apache, or php. phpinfo has no mysql mentioned;

thx for the help in advance.

#5 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 17 March 2006 - 02:06 PM

Is php using the correct php.ini file, check with phpinfo to see that php is using the corret php.ini

Also did restart Apache when you made any changes to your php.ini file?

#6 winthrup7

winthrup7
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 18 March 2006 - 12:00 AM

[!--quoteo(post=355922:date=Mar 17 2006, 09:06 AM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Mar 17 2006, 09:06 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Is php using the correct php.ini file, check with phpinfo to see that php is using the corret php.ini

Also did restart Apache when you made any changes to your php.ini file?
[/quote] [!--coloro:#990000--][span style=\"color:#990000\"][!--/coloro--]Yes, everytime I open it I restart Apache..lol
[!--colorc--][/span][!--/colorc--]
Interesting. Your hint led me to see that in phpinfo, it appears to not be reading the php.ini file (At least the one in C:\Windows).

The extension_dir in phpinfo indicates it is still looking under the default php setting of c:\php5, not c:\php\ext. [Also, phpinfo: Configuration File (php.ini) Path C:\WINDOWS]. The directory is the same. There is only one php.ini file in there.

I of course double checked (for the 5th + time) my directory entries....And the php.ini changes are enabled.
extension_dir ="c:\php\ext"
extension=php_mysql.dll (no semicolon before).

Any thoughts from here? [Does that mean it is not reading the php.ini all together? seeing that it is relying on the default location for extensions, not the directory explicity mentioned in php.ini (and no, Im not crazy, It is in there...lol).

[!--coloro:#990000--][span style=\"color:#990000\"][!--/coloro--]Is there a possibility of another php.ini file it is relying on? It is not in the C:\Windows directory in which phpinfo says its looking for. [I even swapped out the php.ini, and replaced it with a new one, made the changes, and still nothing].????

[!--colorc--][/span][!--/colorc--]

thx.

#7 winthrup7

winthrup7
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 18 March 2006 - 12:33 AM

[!--coloro:#333399--][span style=\"color:#333399\"][!--/coloro--]EDITED: SOMEWHAT OF A FIX

Because it appeared to not be reading the php.ini in C;\Windows, I copied the php.ini file, and placed it in C:\php\ and presto! PhpInfo indicated the correct extension_dir.. etc...and mysql works...


Any thoughts as to why??? I am kind of curious??? thanks again for the help.[!--colorc--][/span][!--/colorc--]

winthrup

[/color]

thx.
[/quote]


#8 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 18 March 2006 - 12:26 PM

It is beacuse you had added C:\php to the WINDOWS Path variable so this is why it is working. Glad you got it sorted out.

#9 DissolutionWIn

DissolutionWIn
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 30 March 2006 - 04:58 AM

im having basically the same issue...i canyt get PHP to run with MySQL...im not sure what the heck im doing wrong...my phpinfo is

www.xpctemecula.com/phpinfo.php

ive checked everything out and all the php.ini files i have all say to look in c:\PHP\ext for the extensions and i have the libmysql in the c:\windows and i have the extensions uncommented in the ini file... what the heck am i doing wrong????


HELP!!

#10 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 30 March 2006 - 12:41 PM

When looking at your phpinfo details. MySQL and MySQLi support is enabled! If phpinof is showing the details about mysql/i then your mysql extensions have enabled and are working.

Also when you make any chnages to both the php.ini or httpd.conf file you must restart the server for the new changes to be made available.

#11 txmedic03

txmedic03
  • Members
  • PipPipPip
  • Advanced Member
  • 313 posts
  • LocationCall, TX, USA

Posted 31 March 2006 - 08:12 AM

[!--quoteo(post=356142:date=Mar 18 2006, 06:26 AM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Mar 18 2006, 06:26 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
It is beacuse you had added C:\php to the WINDOWS Path variable so this is why it is working. Glad you got it sorted out.
[/quote]

No, wildteen88, it is because his particular install of PHP was using c:\php\php.ini as the ini file. It has nothing to do with PATH.


As for, DissolutionWIn, can you give a little more information about your problem. Basically the same problem does not always mean the same solution, so let's retrace your steps and see if we can't find the solution.

SEMPER FIDELIS!

I can't stop you from doing something silly, but at least I can help you do it right.


#12 RogerRAZ

RogerRAZ
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 08 May 2006 - 02:56 AM

I am also having this lovley Fatal error message and I have tried your and every other suggestion, with no luck. When I create the phpinfo file and run it, I do not see an area that says anything about MySQL on the entire page.

If you or anyone else can help me with this I would appreciate it!!! Thanks!

RAZ

#13 skydrop

skydrop
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 05 June 2006 - 10:01 PM

As it was given i did the same but i didnt found php.ini file in c:\windows
but there are two files in php folder php INI-Recommended and php INI-dest
i copied both files and paste in the c:\windows and also made the changes
but still iam getting the same fatal error

Fatal error: Call to undefined function mysql_connect() in e:\webroot\temp_con.php on line 3


[!--quoteo(post=372178:date=May 7 2006, 09:56 PM:name=RogerRAZ)--][div class=\'quotetop\']QUOTE(RogerRAZ @ May 7 2006, 09:56 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
I am also having this lovley Fatal error message and I have tried your and every other suggestion, with no luck. When I create the phpinfo file and run it, I do not see an area that says anything about MySQL on the entire page.

If you or anyone else can help me with this I would appreciate it!!! Thanks!

RAZ
[/quote]


#14 skydrop

skydrop
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 06 June 2006 - 02:04 AM

Try for this iam also getting the same fatal error but finally i solved the problem

firstly there is no php.ini file in c:\windows

Go to php folder where you installed and rename php INI-DEST file to php.ini then copy and paste it to the

c:/windows folder then made changes in that file as already mentioned

Thank you very much to all giving me some idea ...., [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]


[!--quoteo(post=372178:date=May 7 2006, 09:56 PM:name=RogerRAZ)--][div class=\'quotetop\']QUOTE(RogerRAZ @ May 7 2006, 09:56 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
I am also having this lovley Fatal error message and I have tried your and every other suggestion, with no luck. When I create the phpinfo file and run it, I do not see an area that says anything about MySQL on the entire page.

If you or anyone else can help me with this I would appreciate it!!! Thanks!

RAZ
[/quote]


#15 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 06 June 2006 - 02:23 PM

[!--quoteo(post=380448:date=Jun 6 2006, 03:04 AM:name=skyblog)--][div class=\'quotetop\']QUOTE(skyblog @ Jun 6 2006, 03:04 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Try for this iam also getting the same fatal error but finally i solved the problem

firstly there is no php.ini file in c:\windows

Go to php folder where you installed and rename php INI-DEST file to php.ini then copy and paste it to the

c:/windows folder then made changes in that file as already mentioned

Thank you very much to all giving me some idea ...., [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]
[/quote]
Yeah prehaps I should of mentioned that, also you shoud use php.ini-recommended but either file will do.

#16 dottedquad

dottedquad
  • Members
  • Pip
  • Newbie
  • 9 posts

Posted 20 June 2006 - 05:09 PM

Setup: Windows XP Pro, PHP5, and MySQL5.0

My php directory is located in my c:\ which is my root. I didn't feel the need to add the libmysql.dll file and the php.ini to the system directory since I added C:\php to the PATH

doc_root = "c:\inetpub\wwwroot"

extension_dir = "c:\php\ext"

extension=php_mysql.dll

I added ;C:\php to the PATH

I restarted windows XP pro and I still get Fatal error: Call to undefined function mysql_connect() in c:\Inetpub\wwwroot\fitness\dbtest.php on line 15

Am I missing a step here? I have no clue what to do from here.

-Thanks

#17 anaracaix

anaracaix
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 08 August 2006 - 10:24 PM

Well, I moved php.ini to the windows folder, put my extension's folder location in file and uncommented extension=php_mysqli.dll and when I try to install MediaWiki (a PHP script that uses MySQL), I get the error

PHP 5.1.4 installed Could not find a suitable database driver!
For MySQL, compile PHP using --with-mysql, or install the mysql.so module


PHP seems to be working fine with Apache, and MySQL works on its own.  I downloaded PHP from the zip file.

The only thing I can think of is that my php5apache2.dll file is messing things up because I downloaded the file from here because the one that comes with PHP/Apache didn't work, and I kept getting this error.

I am running PHP 5.1.4, Apache 2.2.3, and MySQL 5 on Windows XP.

#18 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 09 August 2006 - 10:00 AM

I think your script requires the php_mysql.dll extension rather than the php_mysqli.dll extension. Also note PHP doesnt officially support Apache2.2.x.

#19 anaracaix

anaracaix
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 10 August 2006 - 01:52 PM

I think your script requires the php_mysql.dll extension rather than the php_mysqli.dll extension. Also note PHP doesnt officially support Apache2.2.x.


I know it doesn't support that version of Apache.  I will try php_mysql.dll, but why php_mysql.dll rather than php_mysqli.dll.  Doesn't MySQL 5 use "mysql improved"?

EDIT: You are right, it now works if I set PHP to use the php_mysql.dll file.

#20 Contradiction

Contradiction
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 13 August 2006 - 05:43 PM

well dudes, if u wonder someday why Contradiction hanged himself, i would tell ya bcoz he tried every single thing to let php talk to mysql,and after 5 days of reading from forums and tutorials and lots of damn things about it, and yet still not working,am really tired of this coz i opened the php.ini more than hundred times and checked it more than thousands,and believe me i did all the steps right and still not working,the steps are:i enabled C:\php to the path,i put libmysql.dll in windows directory and enabled extension_dir="C:\php\ext", & omit the ; before extension=php_mysql.dll,the phpinfo(); indicates that the directory to the extension is correct which is C:\php\ext, and i configured the apache file to take the php.ini file from C:\php and i placed it there and it is showing me correct directory where it is placed as C:\php\php.ini also showing other configurations that i have done to the php.ini, inside the C:\php\ext i have the php_mysql.dll, i even put C:\php\ext in the path, i placed libmysql.dll even in system and system32 windows folder coz i got crazy of the error that it is not loading mysql.dll, am really sick of this error, i made everything for all what the forums said, all the tutorials but still not working :(,plzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz help :D,i will really appreciate that :)
; Directory in which the loadable extensions (modules) reside.
extension_dir = "C:\php\ext"
;extension=php_mssql.dll
;extension=php_msql.dll
extension=php_mysql.dll
;extension=php_oci8.dll
;extension=php_openssl.dl


error_prepend_string no value no value            | <<<--- phpinfo(); indicates that extension_dir is
error_reporting 2047 2047                            |  correctly set to extension_dir,which means that
expose_php On On                                | it is reading from the php.ini,and should load the
extension_dir c:\php\ext c:\php\ext        | extension=php_mysql.dll from C:\php\ext where
file_uploads On On                                | i placed it there !!!!,yet it is not working!!!! :(




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users