Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Call to undefined function on WinXP Pro/PHP5/MySQL

Status
Not open for further replies.

dwcasey

MIS
Oct 31, 2002
179
US
This is on Windows XP Pro. I've installed Apache2, PHP5 and MySQL 4.0.13.

I am working through a tutorial from codewalkers.com.

Part of the tutorial has you create a some .php files to test to make sure PHP is working. The first two test files work fine, it's when I get to the database connect where it gets fouled up.

Here's the php code:

<HTML>
<?php
$db = mysql_connect(&quot;localhost&quot;, &quot;root&quot;, &quot;&quot;);
mysql_select_db(&quot;learndb&quot;,$db);
$result = mysql_query(&quot;SELECT * FROM personnel&quot;,$db);
echo &quot;<TABLE>&quot;;
echo&quot;<TR><TD><B>Full Name</B><TD><B>Nick Name</B><TD><B>Salary</B></TR>&quot;;
while($myrow = mysql_fetch_array($result))
{
echo &quot;<TR><TD>&quot;;
echo $myrow[&quot;firstname&quot;];
echo &quot; &quot;;
echo $myrow[&quot;lastname&quot;];
echo &quot;<TD>&quot;;
echo $myrow[&quot;nick&quot;];
echo &quot;<TD>&quot;;
echo $myrow[&quot;salary&quot;];
}
echo &quot;</TABLE>&quot;;
?>
</HTML>

I have already created the tables. But, it doesn't even look like it's getting a chance to connect base on this error message:

Fatal error: Call to undefined function: mysql_connect() in C:\Apache\Apache2\htdocs\viewdb.php on line 3
 
ur other php file works?

well i am stumped. try pconnect also
mysql_pconnect($host.&quot;:&quot;.$port,$user,$pass);

Known is handfull, Unknown is worldfull
 
If the error message is telling you that mysql_connect() is undefined function, you have not installed the mysql module within apache and php. Try to reinstall the mysql.
 
vbkris,

Pconnect gave similar message. Yes, other PHP stuff works. Here they are:

<HTML>
<?php
phpinfo();
?>
</HTML

And

<HTML>
<?php
echo &quot;Hello World&quot;;
?>
</HTML

Also, if I run the Apache Monitor, it shows PHP 5.0.0b1 in the bottom message bar, so I'm pretty sure it's working.

Gizmicek, I don't remember setting anything up between Apache and MySQL...I have this for PHP:

LoadModule php5_module &quot;d:/php5/sapi/php4apache2.dll&quot;

Is there something similar I need to put in there for MySQL?

How will reinstalling fix this? Thanks.
 
dwcasey:
MySQL communications aren't compiled into Apache, unless you're using the auth_mysql module. MySQL communications are compiled into PHP.

But according to this page: The MySQL client library is no longer bundled with PHP in version 5.0. This is because of changes to the client communications protocol that makes MySQL 3.x and MySQL 4.1.x libraries incompatible.

You're going to have to install the MySQL libraries separately.

Want the best answers? Ask the best questions: TANSTAAFL!!
 
First I echo what sleipnir said, secondly I'll point out that PHP 5 is in it's first beta release. If this site is meant to be used for anything resembling a production server, I'd downgrade to 4.3.2... if you want to stay with 5.0 I would strongly suggest reading through that changelog, there're all sorts of new things in there that you might as well catch up on if you're going to run the latest and greatest.

-Rob
 
I have my php.ini file, in %systemroot%, configured to point to d:\php5\extentions for the extensions_dir...I've commented out:

extentsion=php_msql.dll

And I've copied all the .dll files from php\dlls directory to windows\system32 directory (did not overwrite iconv.dll or ntwdblib.dll). I stopped and restarted Apache without errors and I'm still getting the error when trying to load that .php page.
 
Hmmm, I think I just realized that mSQL is not MySQL and MSSQL is certainly not MySQL...so, any ideas where I can get a php_mysql.dll library?

Still looking on the PHP site and MySQL site...
 
Frankly, I wouldn't fight it. Not for a beta version of PHP, anyway. If they're true to previous developement, there are still four beta release versions and 3 or 4 Release Candidate versions of the software to come before its production-ready. And the programmers reserve the right to change the behavior of nearly anything in the software at any time in beta releases.

Do like skiflyer says: go back to 4.3.2

I missed one thing. There are two reasons why MySQL is not being bundled with PHP. One is the MySQL is GPL, PHP is released under a more restrictive license. Also, the library changes.

Want the best answers? Ask the best questions: TANSTAAFL!!
 
Roger that. Thanks all. I'll hit the 4.3.2 install and see how that goes.

 
Has there been any change in the situation or should we still install the MySQL libraries ourselves?

JR
As a wise man once said: To build the house you need the stone.
Back to the Basics!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top