For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > May 2006 > testing mysql









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author testing mysql
Nospam

2006-04-28, 6:58 pm

i have apache 2.0.55, mysql 5.0.2 and php 5.1.2 I have gone through all the
steps, renaming phpinidist to php.ini and amending httpconf in the apache
folder with localhost, 127.0.0.1 admin email, however on running this sample
php script to determine if mysql is working fine:
<?
// connect to the server:
$cn = mysql_connect("127.0.0.1","root","pass");

// run a simple query
$sql = "SELECT 'done' as my_field LIMIT 1";
$result = mysql_query($sql,$cn);

if($result)
{
// if it worked, print the result to screen
echo mysql_result($result,"my_field");
} else {
// otherwise, either the server isn't running
// or the username/password are wrong
echo mysql_error()."<br />You should see an error message above you?";
}
?>

on running it with http://localhost/mysql.php

I receive Fatal error: Call to undefined function mysql_connect() in
C:\webroot\mysql.php on line 3

I am a little stuck as to where to go from now


Rik

2006-04-28, 6:58 pm

Nospam wrote:
> I receive Fatal error: Call to undefined function mysql_connect() in
> C:\webroot\mysql.php on line 3
>
> I am a little stuck as to where to go from now


http://nl2.php.net/manual/en/ref.mysql.php:

Installation on Linux Systems
PHP 5+

MySQL is not enabled by default, nor is the MySQL library bundled with PHP.
Read this FAQ for details on why. Use the --with-mysql[=DIR] configure
option to include MySQL support. You can download headers and libraries from
MySQL.

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.

If you've done all that, what does phpinfo() say about your MySql support?

Grtz,
--
Rik Wasmus


plato

2006-05-07, 7:01 pm


"Nospam" <nospam@home.com> wrote in message
news:hOt4g.40429$tc.11969@fe2.news.blueyonder.co.uk...
> i have apache 2.0.55, mysql 5.0.2 and php 5.1.2 I have gone through all

the
> steps, renaming phpinidist to php.ini and amending httpconf in the apache
> folder with localhost, 127.0.0.1 admin email, however on running this

sample
> php script to determine if mysql is working fine:
> <?
> // connect to the server:
> $cn = mysql_connect("127.0.0.1","root","pass");
>
> // run a simple query
> $sql = "SELECT 'done' as my_field LIMIT 1";
> $result = mysql_query($sql,$cn);
>
> if($result)
> {
> // if it worked, print the result to screen
> echo mysql_result($result,"my_field");
> } else {
> // otherwise, either the server isn't running
> // or the username/password are wrong
> echo mysql_error()."<br />You should see an error message above you?";
> }
> ?>
>
> on running it with http://localhost/mysql.php
>
> I receive Fatal error: Call to undefined function mysql_connect() in
> C:\webroot\mysql.php on line 3
>
> I am a little stuck as to where to go from now
>

Save yourself a headache...don't waste your time download WAMP and it will
install the whole 3 for you with a minimum of fuss....

Go here: www.en.wampserver.com

cheers


Jim Moore

2006-05-15, 6:57 pm

I was having the same problem, took the advise to install WAMP and had no
success. I searched on Google and the link
http://www.faqts.com/knowledge_base.../23162/fid/1150 reports
that PHP 5 does not add support for MySQL automatically. To use it, you
have to edit php.ini and move the dll identified.
Jim Moore
"plato" <platoTAKETHISOUT@telpacific.com.au> wrote in message
news:445de81e$1@news.rivernet.com.au...
>
> "Nospam" <nospam@home.com> wrote in message
> news:hOt4g.40429$tc.11969@fe2.news.blueyonder.co.uk...
> the
> sample
> Save yourself a headache...don't waste your time download WAMP and it will
> install the whole 3 for you with a minimum of fuss....
>
> Go here: www.en.wampserver.com
>
> cheers
>
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com