2

I'm trying to deploy a php app using addon cleardb/mysql with no success.

What i do is:

git init
git add .
git commit -m "First commit"

heroku create --stack cedar

git push heroku master

heroku addons:add cleardb:ignite

heroku config | grep CLEARDB_DATABASE_URL

heroku config:add DATABASE_URL='mysql://adffdadf2341:adf4234@us-cdbr-east.cleardb.com/heroku_db?reconnect=true'

After that i configure my php app using:

<?php
    $url=parse_url(getenv("mysql://adffdadf2341:adf4234@us-cdbr-east.cleardb.com/heroku_db?reconnect=true"));

    $server = $url["host"];
    $username = $url["user"];
    $password = $url["pass"];
    $db = substr($url["path"],1);

    mysql_connect($server, $username, $password);


    mysql_select_db($db); 

?>

And when i test to connect, i'm getting error:

Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

What can i do? Please, any help?

Thanks.


EDIT:

Ok, i've solved my own question setting server configuration manually:

$server = "us-cdbr-east.cleardb.com";
$username = "adffdadf2341";
$password = "adf4234";
$db = "heroku_db";

Now i have new problem, heroku db:push is not working

!    Taps Load Error: cannot load such file -- taps/operation
!    You may need to install or update the taps gem to use db commands.
!    On most systems this will be:
!  
!    sudo gem install taps

I've installed gem and still same error...

Eusthace
  • 121
  • 1
  • 6

1 Answers1

1

You don't do that

$url=parse_url(getenv("mysql://adffdadf2341:adf4234@us-cdbr-east.cleardb.com/heroku_db?reconnect=true"))

getenv = get an environnment on your unix.

so

$url=parse_url(getenv(CLEARDB_DATABASE_URL)) 

is good.