Laravel - Database [bootstrap] not configured - database

I try using Eloquent in routes.php, but I got a message:
InvalidArgumentException
Database [bootstrap] not configured.
My code is below:
$shop = Shop::where('pid', '1')->first();
Please help me. Thank you very much.

Seems like you missed configuring the database correctly.
Assuming you are on Laravel 4.0 / 4.1 / 4.2, and that you have already setup your database, go to:
app/config/database.php
and check there if you have correct credentials.
Alternative: Maybe you are using the enviroment settings, in that case, check for the database.php files in the directory inside of app/config that corresponds to your current enviroment.

Related

XAMPP WordPress fresh "re-install" - Error establishing a database connection

So, I mucked things up pretty good. I've researched this topic, but none of the solutions I found work or quite fit my situation.
Let me explain. I had somehow managed to get a local install of WordPress using Xampp onto my Win10 PC. I remember it was a struggle then and that was a week ago. Problem is that I forgot my admin password and I couldn't figure out a way around it. So...
I did a database drop in phpmysql and recreated the wp table.
I copied the wp_config.php file into a safe place.
I deleted the wordpress folder in c:/xampp/htdocs.
I downloaded a fresh copy of WordPress and extracted it to c:/xampp/htdocs/wordpress.
I copied the old wp_config.php file into the newly re-created folder.
I ran WordPress install and got to the screen where it says it's installed and here's your user name.
I clicked on the link to the Login screen.
That's when I got the message -- Error establishing a database connection.
I'm not sure how that's possible considering it was just connected and created all the tables in the database.
Here's what's in my wp_config.php file, though I'm not sure what could be wrong with it since it was working fine a second ago (:{):
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wp');
/** MySQL database username */
define('DB_USER', 'root');
/** MySQL database password */
define('DB_PASSWORD', '');
/** MySQL hostname */
define('DB_HOST', 'localhost');
I'm sure someone can tell me where I went wrong and hopefully how to fix it. I'm fine with starting over again. I just want to get it installed so I can learn the inner-workings. ;P
Thanks in advance. I look forward to learning from you all.
Jen
FYI, I ended up uninstalling Xampp and re-installing it in order to resolve this.

Cannot connect to remote Heroku Postgres database using Play Framework 2.2.2

I have an Heroku account and i created an app and an Heroku-Postgres database.
I already commited the app to the Heroku cloud, but i cannot access to the DB that i created.
I'm using play, and when i connect my project in my local DB, the application.conf configurations are:
db.default.driver=org.postgresql.Driver
db.default.url="jdbc:postgresql://localhost:5432/postgres"
db.default.user=postgres
db.default.password=password
And run my server locally and it works fine.
Before i upload my app to Heroku i changed this file to access my Heroku-Postgres DB:
db.default.driver=org.postgresql.Driver
db.default.url="jdbc:postgresql://url:5432/database_name?user=name&password=pass&ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory"
The user and password fields are no longer needed. I've already created a file in the root of my project named "Procfile" that has:
web: target/universal/stage/bin/playsense -Dhttp.port=${PORT} -DapplyEvolutions.default=true -Ddb.default.driver=org.postgresql.Driver -Ddb.default.url=${DATABASE_URL}
I discovered this on the documentation. I don't understand why it doesn't connect to my DB.
I used pgAdminIII with the DB credentials and it works fine.
It's something missing/wrong and i don't know what.
Can someone help me? Thanks in advance!
You probably need to unset the db.default.user and db.default.password config params when running on Heroku. But I'm not sure of an easy way to do that. So what I usually do is to not set them in the conf/application.conf and instead I do something like:
db.default.driver=org.postgresql.Driver
db.default.url="postgres://postgres:password#localhost:5432/postgres"
db.default.url=${?DATABASE_URL}
#db.default.user=postgres
#db.default.password=password
That provides a default db.default.url but overrides it with the DATABASE_URL env var if it is set.

Cakephp requested URL not found

i am using Cakephp1.3 on ubuntu 11.10
i create a table name users . i cake bake the application. and user_controller , views and models all are present.
Now when i am trying to acess http://localhost/yps/users/ it gives following error
Not Found
The requested URL /yps/users/ was not found on this server
Anybody have idea about this
Thanks
Please follow the name convention, like #Joseph said
I encounter the same issue, it's caused by mod_rewrite, like #dhofstet said. Fix it, then everything works well. And how to fix it dependes on your web server's configuration. (http://book.cakephp.org/2.0/en/getting-started.html#a-note-on-mod-rewrite)

Codeigniter CLI Controller mishap

So i followed this tutorial
http://codeigniter.com/user_guide/general/cli.html
and i tried doing
php index.php tools message
but i'm getting this error in terminal:
<h1>A Database Error Occurred</h1>
<p>Unable to connect to your database server using the provided settings.</p>
<p>Filename:/Applications/XAMPP/xamppfiles/htdocs/470repo/projects/main/development/CodeIgniter/third_party/MX/Loader.php</p>
<p>Line Number: 98</p>
I need this in order to bake assets using the Sprinkle library from https://github.com/edmundask/Sprinkle/wiki/Baking-assets
I've been looking around the forum, but I can't find a specific solution to this problem. So, i am in need to saving.
I'm using php version 5.3.1 and the latest version of codeigniter.
Any help would be greatly appreciated, thanks! :)
Are you working from local?
If yes, try changing the hostname from
$db['default']['hostname'] = 'localhost';
to this:
$db['default']['hostname'] = '127.0.0.1';
It seems he can't connect to your database. Did you check your database settings in the database.php config file if it's correct?
If you are using multiple environments, check the part where you set your environment. Maybe he picks the wrong one.
You can also enable logs in the config.php file and check those.

Magento Installation stuck at configuration

I am not sure what is going wrong when I am trying to install magento to my local ubuntu machine.
I did all the steps mentionsed in the magento wiki. Everything goes well until I reach the point where I am here which is the magento config page. When I try and continue after entering the necessary details like host, database name and user name and submit it comes back to the same page. I checked for everything like db in my phomyadmin panel and it still gets stuck there. What is the possible reason for that.
Thanks
Have you try with 127.0.0.1 instead of localhost ?
They have some trouble on login in the admin section.
And check the user/password in the config too !
You have to create a database first and then proceed further.
Step 1 - First create a database with name of your choice like magento
Step 2 - Use that database name in the installation form now
Step 3 - Continue
Hope this solves your problem.
I solved this modifing app/code/core/Mage/Install/etc/config.xml (near 71th string) this
<extensions>
<pdo_mysql/>
</extensions>
for this
<extensions>
<pdo_mysql>1</pdo_mysql>
</extensions>
Verify that you meet the following requirements:
http://www.magentocommerce.com/system-requirements
Magento only runs on php 5.2.x, not 5.3. Also make sure the extensions listed on the requirements page are enabled.
Might be different for you, but I can check the php version using
php -v
Edit
Also what c-verde said about using 127.0.0.1 instead of localhost:
This isn't your current problem, but you'll run into it later. You need to be able to accept cookies to log into Magento. Your browser won't accept cookies for local sites.
In /etc/hosts you need to add
127.0.0.1 localhost.com
And when you install magento you need to use either localhost.com or 127.0.0.1 instead of localhost.
I didn't have this problem with linux, but when installing on windows, it took several minutes after the config page to set up magento. Make sure the browser isn't doing anything.
Before running the installation of Magento:
Navigate to the Varien.php file located in magento/app/code/core/Mage/core/Model/Session/Abstract/Varien.php
You must comment out the last 3 lines in the $cookieParams array:
$cookieParams = array(
'lifetime' => $cookie->getLifetime(),
'path' => $cookie->getPath()
//'domain' => $cookie->getConfigDomain(),
//'secure' => $cookie->isSecure(),
//'httponly' => $cookie->getHttponly()
);
Tick the box for
Skip Base URL Validation Before the Next Step
Check this box only if it is not possible to automatically validate the Base URL.
I also added to my C:\windows\system32\drivers\etc\hosts file
127.0.0.1 www.localhost.com
and removed my magento directory and database tables and started from scratch.
Works for me now.
I did this and it worked!
Navigate to the Varien.php file located in magento/app/code/core/Mage/core/Model/Session/Abstract/Varien.php
You must comment out the last 3 lines in the $cookieParams array:
$cookieParams = array(
'lifetime' => $cookie->getLifetime(),
'path' => $cookie->getPath()
//'domain' => $cookie->getConfigDomain(),
//'secure' => $cookie->isSecure(),
//'httponly' => $cookie->getHttponly()
);
and if you got InnoDB error then do this
Go To Line 59 of the file app/code/core/Mage/Install/Model/Installer/Db/Mysql4.php
Use following code instead of current one
public function supportEngine()
{
$variables = $this->_getConnection()
->fetchPairs('SHOW ENGINES');
return (isset($variables['InnoDB']) && $variables['InnoDB'] != 'NO');
}
Make sure you load php5-mysql extenion. Thats how I solved my problem.
I loaded with http://localhost.com (adding 127.0.0.1 localhost.com to /etc/hosts), it gave my error load pdo-mysql php extension. Otherwise with http://localhost, no error just reloading in configuration page)
I had also been through this problem. I had just create the db first named "magento" and put the 127.0.0.1 instead of localhost. I think, instead of 127.0.0.1, 'localhost' should also work if you had configure it. The problem might be because you didn't have the password for the database but you trying to put the password while installing the magento. Hope this helps some of them.
I had the same problem. Turned out that I was missing a php module but no error was displayed. Megento are now providing a simple php script that checks if the required modules are available and displays an appropriate message if you are missing any of them.
You can find it here - http://www.magentocommerce.com/knowledge-base/entry/how-do-i-know-if-my-server-is-compatible-with-magento
You have to submit username and password as 'root' and 'password' as per db setting
My answer might be late for the PM, but probably useful to those who landed in this page via google.
My experience was that the whole configuration page is a blank page, without any form regarding database, user info or anything.
I fixed it by modifying the {Megento Path}/app/etc/config.xml file.
<default_setup>
<connection>
<host>localhost</host>
<username/>
<password/>
<dbname>magento</dbname>
<model>mysql4</model>
<initStatements>SET NAMES utf8</initStatements>
<type>pdo_mysql</type>
<active>0</active>
</connection>
</default_setup>
Change the value of the host item to anything other than localhost.
Then you get those forms and everything and can move on.
I guess you are missing the port name on which your mysql is running. Try using the port after your hostname for eg. localhost:3306 ,was my configuration settings along with database name and password of your mysql.

Resources