Page 1 of 1
Just starting out PT.2
Posted: Wed Feb 07, 2007 4:32 pm
by Stangguy
Ok so as you may now from PT.1, I couldn't get MYSQL to work on my local computer but I got it to work on a hosted web site that I was using. Well I figured out why it wasn't working on my home computer. Turns out I had two copys installed and the .ini file I was editing was the wrong one! Well now that I fixed that and it works now I run my program on my home computer and I get this:
Code: Select all
Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test.php on line 11
Which would lead me to believe I don't have MySQL installed properly. I have the .dll file in my Apache settings. Any ideas guys. Thanks again for all your help in advance, I promise once I get up and running I will be alot better at all this!
Posted: Wed Feb 07, 2007 4:44 pm
by feyd
did you enable the dll in the php.ini?
Posted: Wed Feb 07, 2007 4:54 pm
by Stangguy
Yes I have this line in my php.ini
extension=php_mysql.dll
and I have reset my Apache.
Posted: Wed Feb 07, 2007 6:12 pm
by volka
What does
Code: Select all
<?php
error_reporting(E_ALL);
ini_set('display_errors', true);
$ini = get_cfg_var('cfg_file_path') or die('no config file');
echo 'ini: ', $ini, "<br />\n";
foreach(file($ini) as $l) {
if ( false!==strpos($l, 'php_mysql')) {
echo 'mysql: ', trim($l), "<br />\n";
}
}
print?
Posted: Wed Feb 07, 2007 6:15 pm
by Stangguy
Code: Select all
ini: C:\Program Files\PHP\php.ini
mysql: extension=php_mysql.dll
Posted: Wed Feb 07, 2007 7:16 pm
by volka
Ok, next step
Code: Select all
<?php
error_reporting(E_ALL);
ini_set('display_errors', true);
echo 'version: ', phpversion(), "<br />\n";
echo 'uname: ', php_uname('srv m'), "<br />\n";
$ini = get_cfg_var('cfg_file_path') or die('no config file');
echo 'ini: ', $ini, "<br />\n";
foreach(file($ini) as $l) {
if ( false!==strpos($l, 'php_mysql')) {
echo 'mysql: ', trim($l), "<br />\n";
}
}
foreach( get_loaded_extensions() as $e ) {
if ( false!==strpos($e, 'mysql')) {
echo 'extension: ', trim($e), "<br />\n";
}
}
Posted: Thu Feb 08, 2007 10:42 pm
by Stangguy
Code: Select all
version: 5.2.0
uname: Windows NT
ini: C:\Program Files\PHP\php.ini
mysql: extension=php_mysql.dll
Posted: Fri Feb 09, 2007 2:04 am
by volka
Take a look at apache's error.log file. Anything related to mysql in there?
Did you do anything to ensure windows can find libmysql.dll? (if you didn't just say so)
Posted: Fri Feb 09, 2007 1:56 pm
by Stangguy
Thanks for your help. After looking at the apache error log I relized it wasn't finding php_mysql.dll. So I put a copy in my windows/system folder and now it works! Thanks for all your help. Let the coding begin!
Posted: Sat Feb 10, 2007 2:32 am
by volka
You shouldn't copy the php extension dll to your system directory.
There's a parameter extension_dir in your php.ini. It should point to the directory where all the extension dll are located.
libmysql.dll is another story.