Just starting out PT.2

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
Stangguy
Forum Newbie
Posts: 12
Joined: Thu Feb 01, 2007 9:31 pm

Just starting out PT.2

Post 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!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

did you enable the dll in the php.ini?
Stangguy
Forum Newbie
Posts: 12
Joined: Thu Feb 01, 2007 9:31 pm

Post by Stangguy »

Yes I have this line in my php.ini

extension=php_mysql.dll

and I have reset my Apache.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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?
Stangguy
Forum Newbie
Posts: 12
Joined: Thu Feb 01, 2007 9:31 pm

Post by Stangguy »

Code: Select all

ini: C:\Program Files\PHP\php.ini
mysql: extension=php_mysql.dll
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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";
	}
}
Stangguy
Forum Newbie
Posts: 12
Joined: Thu Feb 01, 2007 9:31 pm

Post by Stangguy »

Code: Select all

version: 5.2.0
uname: Windows NT
ini: C:\Program Files\PHP\php.ini
mysql: extension=php_mysql.dll
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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)
Stangguy
Forum Newbie
Posts: 12
Joined: Thu Feb 01, 2007 9:31 pm

Post 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!
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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.
Post Reply