wildteen88 Posted March 2, 2006 Share Posted March 2, 2006 The post has been moved to the [url=http://www.phpfreaks.com/forums/index.php/board,41.0.html]FAQ/Code Snippet Repository[/url] forum. Click [url=http://www.phpfreaks.com/forums/index.php/topic,95378.0.html]here[/url] to continue. If you have any questions or problems please post them in this thread. Link to comment https://forums.phpfreaks.com/topic/3914-call-to-undefinded-function-mysql_connect/ Share on other sites More sharing options...
Pche Posted March 4, 2006 Share Posted March 4, 2006 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.dllextension=php_mysql.dllNow, when I starting apache2 (apache1.3 too), gd2 extension is running well, but when starting mysql extension there is error:[b]Entering point mysql_real_espace_string procedure wasn't able to be found in dynamical joined libraryLIBMYSQL[/b]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? Link to comment https://forums.phpfreaks.com/topic/3914-call-to-undefinded-function-mysql_connect/#findComment-14218 Share on other sites More sharing options...
wildteen88 Posted March 5, 2006 Author Share Posted March 5, 2006 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. Link to comment https://forums.phpfreaks.com/topic/3914-call-to-undefinded-function-mysql_connect/#findComment-14377 Share on other sites More sharing options...
winthrup7 Posted March 17, 2006 Share Posted March 17, 2006 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);[b]Php.ini has the correct extension_dir:[/b]extension_dir ="c:\php\ext"[b]php.ini has extension enabled[/b]:extension=php_mysql.dlllibmysql.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. Link to comment https://forums.phpfreaks.com/topic/3914-call-to-undefinded-function-mysql_connect/#findComment-18307 Share on other sites More sharing options...
wildteen88 Posted March 17, 2006 Author Share Posted March 17, 2006 Is php using the correct php.ini file, check with phpinfo to see that php is using the corret php.iniAlso did restart Apache when you made any changes to your php.ini file? Link to comment https://forums.phpfreaks.com/topic/3914-call-to-undefinded-function-mysql_connect/#findComment-18341 Share on other sites More sharing options...
winthrup7 Posted March 18, 2006 Share Posted March 18, 2006 [!--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.iniAlso 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 [b]extension_dir[/b] in phpinfo indicates it is still looking under the default php setting of [b]c:\php5[/b], 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. Link to comment https://forums.phpfreaks.com/topic/3914-call-to-undefinded-function-mysql_connect/#findComment-18469 Share on other sites More sharing options...
winthrup7 Posted March 18, 2006 Share Posted March 18, 2006 [!--coloro:#333399--][span style=\"color:#333399\"][!--/coloro--][b]EDITED: SOMEWHAT OF A FIXBecause 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...[/b]Any thoughts as to why??? I am kind of curious??? thanks again for the help.[!--colorc--][/span][!--/colorc--]winthrup[/color]thx.[/quote] Link to comment https://forums.phpfreaks.com/topic/3914-call-to-undefinded-function-mysql_connect/#findComment-18479 Share on other sites More sharing options...
wildteen88 Posted March 18, 2006 Author Share Posted March 18, 2006 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. Link to comment https://forums.phpfreaks.com/topic/3914-call-to-undefinded-function-mysql_connect/#findComment-18547 Share on other sites More sharing options...
DissolutionWIn Posted March 30, 2006 Share Posted March 30, 2006 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 iswww.xpctemecula.com/phpinfo.phpive 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!! Link to comment https://forums.phpfreaks.com/topic/3914-call-to-undefinded-function-mysql_connect/#findComment-22189 Share on other sites More sharing options...
wildteen88 Posted March 30, 2006 Author Share Posted March 30, 2006 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. Link to comment https://forums.phpfreaks.com/topic/3914-call-to-undefinded-function-mysql_connect/#findComment-22262 Share on other sites More sharing options...
txmedic03 Posted March 31, 2006 Share Posted March 31, 2006 [!--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. Link to comment https://forums.phpfreaks.com/topic/3914-call-to-undefinded-function-mysql_connect/#findComment-22558 Share on other sites More sharing options...
RogerRAZ Posted May 8, 2006 Share Posted May 8, 2006 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 Link to comment https://forums.phpfreaks.com/topic/3914-call-to-undefinded-function-mysql_connect/#findComment-34198 Share on other sites More sharing options...
skydrop Posted June 5, 2006 Share Posted June 5, 2006 As it was given i did the same but i didnt found php.ini file in c:\windowsbut there are two files in php folder php INI-Recommended and php INI-desti copied both files and paste in the c:\windows and also made the changes but still iam getting the same fatal errorFatal 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] Link to comment https://forums.phpfreaks.com/topic/3914-call-to-undefinded-function-mysql_connect/#findComment-42204 Share on other sites More sharing options...
skydrop Posted June 6, 2006 Share Posted June 6, 2006 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] Link to comment https://forums.phpfreaks.com/topic/3914-call-to-undefinded-function-mysql_connect/#findComment-42261 Share on other sites More sharing options...
wildteen88 Posted June 6, 2006 Author Share Posted June 6, 2006 [!--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. Link to comment https://forums.phpfreaks.com/topic/3914-call-to-undefinded-function-mysql_connect/#findComment-42419 Share on other sites More sharing options...
dottedquad Posted June 20, 2006 Share Posted June 20, 2006 Setup: Windows XP Pro, PHP5, and MySQL5.0My 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 [i]PATH[/i]doc_root = "c:\inetpub\wwwroot"extension_dir = "c:\php\ext"extension=php_mysql.dllI added ;C:\php to the [i]PATH[/i]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 15Am I missing a step here? I have no clue what to do from here.-Thanks Link to comment https://forums.phpfreaks.com/topic/3914-call-to-undefinded-function-mysql_connect/#findComment-47734 Share on other sites More sharing options...
anaracaix Posted August 8, 2006 Share Posted August 8, 2006 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 [quote]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[/quote]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 [url=http://www.apachelounge.com/download/]here[/url] because the one that comes with PHP/Apache didn't work, and I kept getting [url=http://www.phpfreaks.com/forums/index.php/topic,103091.0.html]this[/url] error.I am running PHP 5.1.4, Apache 2.2.3, and MySQL 5 on Windows XP. Link to comment https://forums.phpfreaks.com/topic/3914-call-to-undefinded-function-mysql_connect/#findComment-71450 Share on other sites More sharing options...
wildteen88 Posted August 9, 2006 Author Share Posted August 9, 2006 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. Link to comment https://forums.phpfreaks.com/topic/3914-call-to-undefinded-function-mysql_connect/#findComment-71675 Share on other sites More sharing options...
anaracaix Posted August 10, 2006 Share Posted August 10, 2006 [quote author=wildteen88 link=topic=87276.msg412317#msg412317 date=1155117603]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.[/quote]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. Link to comment https://forums.phpfreaks.com/topic/3914-call-to-undefinded-function-mysql_connect/#findComment-72468 Share on other sites More sharing options...
Contradiction Posted August 13, 2006 Share Posted August 13, 2006 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.dllextension=php_mysql.dll;extension=php_oci8.dll;extension=php_openssl.dlerror_prepend_string no value no value | <<<--- phpinfo(); indicates that extension_dir iserror_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 theextension_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!!!! :( Link to comment https://forums.phpfreaks.com/topic/3914-call-to-undefinded-function-mysql_connect/#findComment-74132 Share on other sites More sharing options...
Contradiction Posted August 13, 2006 Share Posted August 13, 2006 sorry dudes am running Apache 2.2.3 & php 5.2 and they are running in perfect way,i just got the mysql error :(,plz help, i posted the details in prev messsage Link to comment https://forums.phpfreaks.com/topic/3914-call-to-undefinded-function-mysql_connect/#findComment-74135 Share on other sites More sharing options...
Contradiction Posted August 13, 2006 Share Posted August 13, 2006 yeppppppppppppppppy it worked, the problem that i was using php 5.1 before but it was not compatable for apache2.2.3 so i downloaded php 5.2 so it has some files compatable with apache 2.2.3, but before that i placed php5ts.dll version 5.1 in the apache bin file, and that was making troubles for my enabling mysql, so after removing this file from the apache bin folder, it is working now :D, laterz ;), thx dudes :P Link to comment https://forums.phpfreaks.com/topic/3914-call-to-undefinded-function-mysql_connect/#findComment-74148 Share on other sites More sharing options...
dsartain Posted August 13, 2006 Share Posted August 13, 2006 Ok, I've followed the directions to the T..I think. I've modified the PHP.ini file to call for the extensions dir and php_mysql.dll...libmysql.dll is in the winnt directory (I'm running Win2K). PHP runs by itself just fine. MySQL runs by itself just fine. Whenever I try to insert data in a DB via PHP, the web page comes up blank...it shouldn't do that...any ideas?? Link to comment https://forums.phpfreaks.com/topic/3914-call-to-undefinded-function-mysql_connect/#findComment-74210 Share on other sites More sharing options...
wildteen88 Posted August 15, 2006 Author Share Posted August 15, 2006 Does it connect fine to the database? Ie:[code=php:0]$conn = mysql_connect('localhost', 'user', 'pass') or die('Unable to connect to the MySQL server<br /><br />' . mysql_error());mysql_select_db('db_name') or die('Unable to connect to the database<br /><br />' . mysql_error());echo "Connected to MySQL and the database fine";[/code]If it does then it most probably an error withing your SQL Query. Add this - [code=php:0]or die(mysql_error());[/code] to end of the the mysql_query function when you perform your query.Also you might want to post a help topic in the PHP Help forum. If you query is failing. Link to comment https://forums.phpfreaks.com/topic/3914-call-to-undefinded-function-mysql_connect/#findComment-75021 Share on other sites More sharing options...
dsartain Posted August 16, 2006 Share Posted August 16, 2006 Ok, I fixed the problem making the screen come up blank. I didn't have short tags enabled (IE: had to use <?php instead of <?) Now I'm getting the following error:Fatal error: Call to undefined function mysql_connect() in c:\Inetpub\wwwroot\PHP\database.php on line 28I know the code is right because it worked on a different server, but somehow PHP isn't talking to MySQL...I've set the extension_dir = "C:\PHP\ext" and extension="C:\PHP\ext\php_mysqli.dll"MySQL section of PHP.ini is as follows:[MySQLi]; Maximum number of links. -1 means no limit.mysqli.max_links = -1; Default port number for mysqli_connect(). If unset, mysqli_connect() will use; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the; compile-time value defined MYSQL_PORT (in that order). Win32 will only look; at MYSQL_PORT.mysqli.default_port = 3306; Default socket name for local MySQL connects. If empty, uses the built-in; MySQL defaults.mysqli.default_socket =; Default host for mysql_connect() (doesn't apply in safe mode).mysqli.default_host = localhost; Default user for mysql_connect() (doesn't apply in safe mode).mysqli.default_user = dsartain; Default password for mysqli_connect() (doesn't apply in safe mode).; Note that this is generally a *bad* idea to store passwords in this file.; *Any* user with PHP access can run 'echo get_cfg_var("mysqli.default_pw"); and reveal this password! And of course, any users with read access to this; file will be able to reveal the password as well.mysqli.default_pw =; Allow or prevent reconnectmysqli.reconnect = OnPHP/MySQL Connection Code is below:[code]$dbconn = mysql_connect("localhost","dsartain","marines"); mysql_select_db("test2",$dbconn); $query = "INSERT INTO `contacts` VALUES('$firstname','$lastname','$address','$apt','$city','$state','$zip','$email','$phone1_type','$phone1','$phone2_type','$phone2')";$runquery = mysql_query($query,$dbconn);[/code]PHP works fine in and of itself, same thing for MySQL. They just don't talk to each other...any ideas?? Link to comment https://forums.phpfreaks.com/topic/3914-call-to-undefinded-function-mysql_connect/#findComment-75460 Share on other sites More sharing options...
Recommended Posts