php - Laravel 4.1 to Heroku: SQLSTATE[HY000] [2002] No such file or directory -
i deployed laravel 4.1 app in heroku following article http://phpartisan.tumblr.com/post/71580870739/running-laravel-4-on-heroku
the static html homepage loaded okay when trying log-in, getting error
sqlstate[hy000] [2002] no such file or directory my local setup laravel 4.1 & mysql.
i don't think there database created when deployed.
do need manually? how , settings then?
thanks!
the problem environment might still point local. in cli, type heroku run php artisan env find out.
else, might wanto run php artisan migrate --env=production set correct production environment.
you might encounter issue this:
php fatal error: call undefined function symfony\component\console\mb_convert_variables() in /var/www/mysite/vendor/symfony/console/symfony/component/console/application.php on line 1154
trust me, tt has nothing mb_string module post stated. laravel: call undefined function symfony\component\console\mb_convert_variables()?
the problem @ environment setting.
first, make sure have .env.php file @ same dir level composer.json , exists in heroku instance. since cant ftp inside, need push repo. laravel tell git ignored, need temporary allow push heroku repo.
next, need edit bootstrap\start.php
replace $env = $app->detectenvironment(function(){}) to:
$env = $app->detectenvironment(function() { return file_exists(dirname(__file__) . '/../.env.php') ? 'production' : 'local'; }); once done these, rerun migrate command , works.
you may follow link reference. laravel environment config not loading, migration fails - sqlstate[hy000] [2002] no such file or directory
Comments
Post a Comment