Guest droz Posted July 1, 2006 Share Posted July 1, 2006 i've been searching the internet for a while. Tried everything this forum and all other sites say and nothing works.I just recently installed :MySql 5.0Apache 2.2PHP 5.1.4on a windows xp computer.Php and Apache work fine together, and MySql works fine on it's own.I looked under control panel - administrative tools - services......and MySql is running.i've done the following changes to my php.ini file :Change : ;extension=php_mysql.dllto : extension=php_mysql.dll //////extension_dir = "C:\PHP\ext" (where all my .dll files are located)/////extension=php_mysqli.dll/////and some other things other forums said to try but none workedI've tried copying the libmysql.dll and libmysqli.dll files into C:\PHP\ext, C:\windows, C:\system, C:\system32, and that didn't workWhen i use <?php phpinfo() ?> i read a big section should be on there about mysql, but there isn't. The only thing refering to mySql is :Apache Enviornmentvariable ValuePath C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\ATI Technologies\ATI Control Panel;C:\Program Files\Common Files\Adaptec Shared\System;[b]C:\Program Files\MySQL\MySQL Server 5.0\bin[/b]Also the same thing, as shown above, is under "PHP Variables" and "Enviornment" sections.And i made sure it's pointing to the right php.ini filethis is the output of C:\PHP>php -m (which from what i've seen from others, ??? looks normal)[PHP Modules]bcmathcalendarcom_dotnetctypedatedomftphashiconvlibxmlmbstringmsqlmysqlmysqliodbcpcreReflectionsessionSimpleXMLSPLstandardtokenizerwddxxmlxmlreaderxmlwriterzlib[Zend Modules]I read in one forum to copy a config.php.dist file over an existing config.php file, but i couldn't find a config.php on my computer.Also i read that a mysql.so file needs to be loaded into the php.ini file but when i put extension=mysql.so into my php.ini file the following happensC:\PHP>php -mPHP Warning: PHP Startup: Unable to load dynamic library 'c:\PHP\ext\mysql.so'-The specified module could not be found. in Unknown on line 0//followed by what was in the last outputSo i searched my computer for a mysql.so file....I didn't find it.And this is what my .php file looks like that i'm trying to run: <?php$dbServer='localhost';$dbUser='username';$dbPass='password';$dbName='test'; $link = mysql_connect("$dbServer", "$dbUser", "$dbPass") or die("Could not connect"); print "Connected successfully<br>"; mysql_select_db("$dbName") or die("Could not select database"); print "Database selected successfully<br>";mysql_close($link);?>The username and password are correctI've also tried using another database instead of "test"Also i have tried using the PEAR DB class to connect to Mysql using the following code:<?php require_once('pear\DB.php');$username = 'username';$password = 'password';$hostspec = 'localhost';$database = 'bank';$phptype = 'mysql';$dsn = "$phptype://$username:$password@$hostspec/$database";$conn = DB::connect($dsn);if (DB::isError($conn)) { die ("Cannot connect:" . $conn->getMessage () . "\n");}?>And "Cannot connect:DB Error: not found" shows up on the screen when i use that script.I think thats all i have tried, if anyone can help me it would be appreciated! Quote Link to comment https://forums.phpfreaks.com/topic/13377-call-to-undefined-function-mysql_connect/ Share on other sites More sharing options...
wildteen88 Posted July 1, 2006 Share Posted July 1, 2006 Please read [url=http://www.phpfreaks.com/forums/index.php/topic,95378.0.html]this thread[/url]. You need to enable the mysql extension and setup the extension_dir directive in the php.ini. Which the post provided explains. Quote Link to comment https://forums.phpfreaks.com/topic/13377-call-to-undefined-function-mysql_connect/#findComment-51642 Share on other sites More sharing options...
steveo48 Posted July 1, 2006 Share Posted July 1, 2006 Thanks i'll try a diffrent version of apache Quote Link to comment https://forums.phpfreaks.com/topic/13377-call-to-undefined-function-mysql_connect/#findComment-51645 Share on other sites More sharing options...
wildteen88 Posted July 1, 2006 Share Posted July 1, 2006 Also DONT move the extensions out of the ext directory. Also when you make changes to the php.ini make sure you restart the server. Also I notice you are using Apache2.2, unless I am mistaken, currently PHP doesn't offically support this version of Apache. You might want to downgrade to Apache 2.0.xAlso about the mysql.so file I believe that is for OS other than Windows. PHP Extensions for Windowws are dll files. .so files are for other OS I beleive. Quote Link to comment https://forums.phpfreaks.com/topic/13377-call-to-undefined-function-mysql_connect/#findComment-51646 Share on other sites More sharing options...
steveo48 Posted July 1, 2006 Share Posted July 1, 2006 I went tired apache 2.0 same thing happened i double checked to make sure extension_dir = "C:\PHP\ext" was in the right section and it wasany futher help would be appreciated! Quote Link to comment https://forums.phpfreaks.com/topic/13377-call-to-undefined-function-mysql_connect/#findComment-51652 Share on other sites More sharing options...
wildteen88 Posted July 1, 2006 Share Posted July 1, 2006 OKay have you moved a file called libmysql.dll form the root of the PHP folder to the windows folder.Make sure you move any files and modify any files you restart the server for the new settings to be loaded into memory, otherwise the new settings wont come available until the server is restarted. Also add the PHP folder to the Windows Path variable and add the following line:#PHPIniDirPHPIniDir "C:/PHP"To Apache httpd.conf file too. POlace the php.ini in the PHP folder when you add the PHP folder to Windows PATH variable.When you create the chnage the PATH variable you must restart your computer. Quote Link to comment https://forums.phpfreaks.com/topic/13377-call-to-undefined-function-mysql_connect/#findComment-51654 Share on other sites More sharing options...
steveo48 Posted July 1, 2006 Share Posted July 1, 2006 Thanks adding that path variable made it workCould you tell me why that made it work...if you dont mind ;D...and sorry i just read that topic in your sig that suggested to do that Quote Link to comment https://forums.phpfreaks.com/topic/13377-call-to-undefined-function-mysql_connect/#findComment-51657 Share on other sites More sharing options...
wildteen88 Posted July 1, 2006 Share Posted July 1, 2006 Basically when you add the PHP folder to the PATH it allows PHP to look for files automatically as it can access itself. It is best to add the PHP folder to the PATH as then all PHP related files are located in one place which is the PHP folder. However instead of creating a PHP folder can threoretically move all the files and folders from the PHP folder to the Windows folder or the System32 Folder. Quote Link to comment https://forums.phpfreaks.com/topic/13377-call-to-undefined-function-mysql_connect/#findComment-51666 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.