Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
    
Please, any help? –  Eusthace Feb 4 '13 at 13:12
add comment

1 Answer

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.