# I can't access MySQL database with emerged apache php mysql

## OpTiKoOl

Hello all,

i am having problems accessing a MySQL database with a very simple php script..

i've set the USE var like USE="mysql" emerge php apache mysql, and i've my mysql server working properly...as Apache 1.x and php..

i even tested my php with a '<? phpinfo(); ?>' wich worked...

the problem is that now i wont to use mysql too...but without success...

when i try to access the php script that as in 

$mysql_link = mysql_connect('$dbhost,'$dbuser','$dbpassword');

i get an error like ...

Fatal error: Call to undefined function: mysql_connect() in /home/httpd/htdocs/testes/ui.php on line 9

thats te line to connect to mysql...i even try to install after all this phpmyadmin..

and it's not running too...

giving me...

cannot load MySQL extension,

please check PHP Configuration.

Documentation

i don't know what it is..cos everything it's workin' fine...

can please someone else give me a hand ?!   :Sad: 

PS - if i try to run the ui.php script from the shell (php ui.php) it simply runs fine..without output any error message...  :Sad: 

what's happening ?!

```

```

```

```

----------

## LimeFrog

And you have started mySQL?

----------

## OpTiKoOl

sure i have...i've even looked in the MySQL log file (/var/log/mysql/mysql.log)

here a little output..

030506 21:05:49      30 Connect     root@localhost on 

                                 30 Quit       

..

that's a log ...runing the script from the console :\

what u think it is ?

----------

## OpTiKoOl

sure i have...i've even looked in the MySQL log file (/var/log/mysql/mysql.log)

here a little output..

030506 21:05:49      30 Connect     root@localhost on 

                                 30 Quit       

..

that's a log ...runing the script from the console :\

what u think it is ?

----------

## LimeFrog

Ah, i see the error now.  :Laughing: 

You simply forgot to put a ' after '$dbuser.

```
$mysql_link = mysql_connect('$dbhost-->'<--,'$dbuser','$dbpassword');
```

----------

## OpTiKoOl

hey its wrong..u right..but hete..in the forum..i write it down..and i didn't paste it from the php script..

u right...but i'm still fuck*d up..cos in the script it is right...   :Sad: 

PS - Still don't have a clue ...damn   :Sad: 

----------

## LimeFrog

When you run <? phpinfo(); ?> does it show any info about mySQL?

My guess would be that the mySQL libraries not were installed when PHP was compiled, try and reinstall PHP and see if that does the trick for you.

----------

## darktux

The answear is obvious... mod_php wasn't compiled with MySQL support.... Do USE="mysql" emerge mod_php and reach nirvana   :Wink: 

----------

## OpTiKoOl

yeah...the problem seems to be that...

i'm very happy now..

thanks a lot guys...i apriciate your help and time spending on me...

oh..and btw...u can count on that darktux...  :Wink: 

nirvana reached!   :Very Happy: 

----------

## wishkah

Hey, I didn't realize mysql could reveal the non-existance of the self   :Smile:   That's a highly underadvertised feature, IMO   :Rolling Eyes: 

----------

