damjanko Posted November 28, 2006 Share Posted November 28, 2006 Version Apache 2.2.3PHP 5.2Windows XPThe same php file get the error on IISFatal error: Call to undefined function mysql_connect() in C:\L\Site1\index.php on line 2Same file works with apache on port localhost:8080but not in IIS localhostcode is<?php$con = mysql_connect("localhost","root","sa");if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("damjan", $con);$result = mysql_query("SELECT * FROM partner");while($row = mysql_fetch_array($result)) { echo $row[0] . " " . $row[1] . " " . $row[2]; echo "<br />"; }mysql_close($con);?>I Try this but still get a error1. Open the php.ini file and make the following changes to its contents (php.ini is a text file and resides in C:\WINNT)Change this : ;extension=php_mysql.dllto : extension=php_mysql.dll(the semicolon at the start is removed)Then give the correct path to the extensions directoryextension_dir = "C:\Program_Files\php\morephp"(in my case I created a directory called 'morephp' to store all the extensions. If your directory is called 'extensions' the line would beextension_dir = "C:\Program_Files\php\extensions")2) Then copy the following files in to the morephp directory (as I have mentioned above, morephp is a name I gave to a directory into which I dump all the extensions):php_mysql.dllphp_mysqli.dllThe 2 files are available for download hereAnd... you should live happily ever after!Remember to restart IIS before viewing pages.3) Should you still face problems try this. Copy the following fileslibmysql.dlllibmysqli.dllin toc:\windows\system32The 2 files are available for download here4) Still does not work? Try this slightly radical step.Here is a dump of all the dll files you would possibly need for PHP5 installation. Simply copy all the files from this directory in to your morephp directory. Link to comment https://forums.phpfreaks.com/topic/28795-same-php-file-with-mysql-connection-works-on-apache-but-not-on-iis/ Share on other sites More sharing options...
fenway Posted November 29, 2006 Share Posted November 29, 2006 I'm not the expert on this, there's a FAQ in the PHP help section I think, but I'm fairly sure phpinfo() will confirm that you've not installed the extension properly. Link to comment https://forums.phpfreaks.com/topic/28795-same-php-file-with-mysql-connection-works-on-apache-but-not-on-iis/#findComment-132086 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.