Author Topic: Call To Undefinded Function mysql_connect  (Read 41476 times)

0 Members and 1 Guest are viewing this topic.

Offline wildteen88Topic starter

  • Guru
  • 'Insane!'
  • *
  • Posts: 12,021
  • Gender: Male
    • View Profile
Call To Undefinded Function mysql_connect
« on: March 02, 2006, 10:06:51 AM »
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.
« Last Edit: September 20, 2006, 05:25:29 AM by wildteen88 »

Offline Pche

  • Irregular
  • Posts: 1
    • View Profile
Enable MySQL Support in PHP5!
« Reply #1 on: March 04, 2006, 01:28:48 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?

Offline wildteen88Topic starter

  • Guru
  • 'Insane!'
  • *
  • Posts: 12,021
  • Gender: Male
    • View Profile
Enable MySQL Support in PHP5!
« Reply #2 on: March 05, 2006, 07:32:56 AM »
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.

Offline winthrup7

  • Irregular
  • Posts: 3
    • View Profile
Enable MySQL Support in PHP5!
« Reply #3 on: March 17, 2006, 05:43:57 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;

thanks for the help in advance.

Offline wildteen88Topic starter

  • Guru
  • 'Insane!'
  • *
  • Posts: 12,021
  • Gender: Male
    • View Profile
Enable MySQL Support in PHP5!
« Reply #4 on: March 17, 2006, 09:06:01 AM »
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?

Offline winthrup7

  • Irregular
  • Posts: 3
    • View Profile
Enable MySQL Support in PHP5!
« Reply #5 on: March 17, 2006, 07:00:01 PM »
[!--quoteo(post=355922:date=Mar 17 2006, 09:06 AM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Mar 17 2006, 09:06 AM) [snapback]355922[/snapback][/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--]

thanks.

Offline winthrup7

  • Irregular
  • Posts: 3
    • View Profile
Enable MySQL Support in PHP5!
« Reply #6 on: March 17, 2006, 07:33:17 PM »
[!--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]

thanks.
[/quote]

Offline wildteen88Topic starter

  • Guru
  • 'Insane!'
  • *
  • Posts: 12,021
  • Gender: Male
    • View Profile
Enable MySQL Support in PHP5!
« Reply #7 on: March 18, 2006, 07:26:04 AM »
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.

Offline DissolutionWIn

  • Irregular
  • Posts: 1
    • View Profile
Enable MySQL Support in PHP5!
« Reply #8 on: March 29, 2006, 11:58:45 PM »
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!!
« Last Edit: March 29, 2006, 11:59:49 PM by DissolutionWIn »

Offline wildteen88Topic starter

  • Guru
  • 'Insane!'
  • *
  • Posts: 12,021
  • Gender: Male
    • View Profile
Enable MySQL Support in PHP5!
« Reply #9 on: March 30, 2006, 07:41:53 AM »
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.

Offline txmedic03

  • Enthusiast
  • Posts: 283
  • Gender: Male
    • View Profile
    • http://www.razorbone.com
Enable MySQL Support in PHP5!
« Reply #10 on: March 31, 2006, 03:12:25 AM »
[!--quoteo(post=356142:date=Mar 18 2006, 06:26 AM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Mar 18 2006, 06:26 AM) [snapback]356142[/snapback][/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.


Little town with a cell phone for an internet connection. lol

Offline RogerRAZ

  • Irregular
  • Posts: 4
    • View Profile
Enable MySQL Support in PHP5!
« Reply #11 on: May 07, 2006, 10:56:28 PM »
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

Offline skydrop

  • Irregular
  • Posts: 3
    • View Profile
Enable MySQL Support in PHP5!
« Reply #12 on: June 05, 2006, 06:01:42 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) [snapback]372178[/snapback][/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]

Offline skydrop

  • Irregular
  • Posts: 3
    • View Profile
Enable MySQL Support in PHP5!
« Reply #13 on: June 05, 2006, 10:04:14 PM »
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) [snapback]372178[/snapback][/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]

Offline wildteen88Topic starter

  • Guru
  • 'Insane!'
  • *
  • Posts: 12,021
  • Gender: Male
    • View Profile
Enable MySQL Support in PHP5!
« Reply #14 on: June 06, 2006, 10:23:27 AM »
[!--quoteo(post=380448:date=Jun 6 2006, 03:04 AM:name=skyblog)--][div class=\'quotetop\']QUOTE(skyblog @ Jun 6 2006, 03:04 AM) [snapback]380448[/snapback][/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.