agzis Posted February 13, 2008 Share Posted February 13, 2008 Hi, I have php version 5.2.5; MySQL version 5.0.51a-community-nt. I installed php with MySQL support. I placed test function mysql_connect() to connect to MySQL db and received an error. "Fatal error: Call to undefined function mysql_connect() in H:\website\install\test\MySQLTest.php on line 5 " I read instructions in php.net that I must compile php with flag --with-mysql. Compilation gave me a lot of errors. Is there some walkaround to enable php to connect to MySQL database? Any help greatly appreciated. Thanks. agzis. Quote Link to comment https://forums.phpfreaks.com/topic/90813-php-and-mysql/ Share on other sites More sharing options...
PFMaBiSmAd Posted February 13, 2008 Share Posted February 13, 2008 What operating system? Quote Link to comment https://forums.phpfreaks.com/topic/90813-php-and-mysql/#findComment-465486 Share on other sites More sharing options...
agzis Posted February 13, 2008 Author Share Posted February 13, 2008 Windows XP Pro SP2 Quote Link to comment https://forums.phpfreaks.com/topic/90813-php-and-mysql/#findComment-465527 Share on other sites More sharing options...
PFMaBiSmAd Posted February 13, 2008 Share Posted February 13, 2008 The Windows php binary is already complied with support for all the official language extensions. This is from the php manual for the mysql functions - Installation on Windows Systems PHP 5+ MySQL is no longer enabled by default, so the php_mysql.dll DLL must be enabled inside of php.ini. Also, PHP needs access to the MySQL client library. A file named libmysql.dll is included in the Windows PHP distribution and in order for PHP to talk to MySQL this file needs to be available to the Windows systems PATH. See the FAQ titled "How do I add my PHP directory to the PATH on Windows" for information on how to do this. Although copying libmysql.dll to the Windows system directory also works (because the system directory is by default in the system's PATH), it's not recommended. As with enabling any PHP extension (such as php_mysql.dll), the PHP directive extension_dir should be set to the directory where the PHP extensions are located. See also the Manual Windows Installation Instructions. An example extension_dir value for PHP 5 is c:\php\ext Quote Link to comment https://forums.phpfreaks.com/topic/90813-php-and-mysql/#findComment-465537 Share on other sites More sharing options...
agzis Posted February 13, 2008 Author Share Posted February 13, 2008 I did exactly how it was described. I even reinstalled php. Error the same. Quote Link to comment https://forums.phpfreaks.com/topic/90813-php-and-mysql/#findComment-465574 Share on other sites More sharing options...
PFMaBiSmAd Posted February 13, 2008 Share Posted February 13, 2008 Check your web server log for errors to help pinpoint what is wrong. Either the .dll is missing, the path to the extension dll's is wrong in php.ini, the path to your php installation is not in the Windows path statement, you did not reboot your computer after making any changes to the Windows path statement, the php.ini that you are using is not the same one that php is using, the line in php.ini to load the php_mysql.dll is commented out, you did not stop and start the web server after making changes to php.ini, and probably a few more things that are mentioned in the installation instructions that I don't recall off of the top of my head. Quote Link to comment https://forums.phpfreaks.com/topic/90813-php-and-mysql/#findComment-465592 Share on other sites More sharing options...
agzis Posted February 13, 2008 Author Share Posted February 13, 2008 I checked IIS log, it's no errors recorded. Everything runs with success status 200. Restarted services/IIS. Changed path. But problem pesist. Quote Link to comment https://forums.phpfreaks.com/topic/90813-php-and-mysql/#findComment-465782 Share on other sites More sharing options...
wildteen88 Posted February 13, 2008 Share Posted February 13, 2008 I read instructions in php.net that I must compile php with flag --with-mysql. Compilation gave me a lot of errors. Is there some walkaround to enable php to connect to MySQL database? Why did you recompile PHP? PHP does not need recompiling on Windows. Also please read the following FAQ Quote Link to comment https://forums.phpfreaks.com/topic/90813-php-and-mysql/#findComment-466074 Share on other sites More sharing options...
agzis Posted February 13, 2008 Author Share Posted February 13, 2008 I did exactly how it was described in FAQ. Placed files to windows/system32 directory, restart server. It's still show the error: "Fatal error: Call to undefined function mysql_connect() " Quote Link to comment https://forums.phpfreaks.com/topic/90813-php-and-mysql/#findComment-466216 Share on other sites More sharing options...
agzis Posted February 13, 2008 Author Share Posted February 13, 2008 BTW, all php extensions do not work (php_iisfunc, php_mssql, php_mysql) but they were installed correctly. They(dlls) located at ext folder of php installation. There are entries at the end of php.ini file like [php_MS_SQL] extension=php_mssql.dll [php_MYSQL] extension=php_mysql.dll and so on. But all these entries added during gui install. Quote Link to comment https://forums.phpfreaks.com/topic/90813-php-and-mysql/#findComment-466223 Share on other sites More sharing options...
rhodesa Posted February 13, 2008 Share Posted February 13, 2008 Save yourself the hassle, use WAMP: http://www.wampserver.com Quote Link to comment https://forums.phpfreaks.com/topic/90813-php-and-mysql/#findComment-466224 Share on other sites More sharing options...
agzis Posted February 13, 2008 Author Share Posted February 13, 2008 WAMP rulez!!! It works. Thanks. :) Quote Link to comment https://forums.phpfreaks.com/topic/90813-php-and-mysql/#findComment-466272 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.