Database Error while connecting from Localhost |
I'm fairly new to development and I'm completely new to codeigniter.
I've downloaded a CodeIgniter project from my company's server that I inherited from a previous developer. I need to add a new page to the site. Since I'm new to CI, I (obviously) don't want to edit the live site but I can't get the site to run locally. I'm trying to run it on a local server either through MAMP or through the PHP server in terminal on a Mac running Yosemite 10.10.5. I've added the project folder to htdocs in MAMP but when I open http://localhost:8888/index.php/contact the screen is blank. When I try to access the same folder through the terminal using: Code: env DB_USER=XXXX DB_PASSWD=XXXX DB_NAME=XXXX php -S localhost:8080 (where 'XXXX' is replaced with our database username and password) I get the following error: Quote:Unable to connect to your database server using the provided settings. Line 346 of core/Loader.php is the public function database in the attached image. Things I've tried:
Any help is much appreciated as I just started this new position, this is one of my first projects for the company and it has me stumped. I still need to figure out how to add a page, but I can't even get the site loaded locally so I can work on it. Thanks
Check out the error logs (either in your server log folder or in CI's log folder /application/logs).
(04-08-2017, 09:08 PM)SDillon001 Wrote: I'm fairly new to development and I'm completely new to codeigniter. Have you import the database file to your database server?
(04-09-2017, 01:16 AM)janudewangga Wrote:(04-08-2017, 09:08 PM)SDillon001 Wrote: I'm fairly new to development and I'm completely new to codeigniter. No, I haven't imported the database to my local computer, I'm trying to connect to the live database that the live website connects to......? Is that possible? Or do I need to import it since I'm trying to view the site on a local server?
**Update**
I downloaded a copy of my live database from the server to my local computer but I still can't access it. I tried removing the user and password (leaving the DB name) and still nothing. Any thoughts?
Make sure you're connecting using localhost details. Usually:
Host: localhost User: root Pass:
(04-09-2017, 08:38 PM)JayAdra Wrote: Make sure you're connecting using localhost details. Usually: Thanks Jay, I did try that. It looks like my database connection has been customized. Here's what my `database.php` file looks like.....it's not setup as an array (image also attached): Code: $active_group = 'default';
(04-10-2017, 02:35 AM)JayAdra Wrote: Did you check the error logs? What's the exact error you're getting? Here are 2 links to videos to hopefully explain / illustrate better what I'm working with and the error I'm getting. I have the database file inside the project folder......? I'm not sure why that's there or what to do with it. Link #1 - Trying to run on built-in PHP server and / or MAMP: https://youtu.be/5p43JyROUOs Link #2 - Database file in Project Folder: https://youtu.be/A7I2VEQPXtg
Sorry, I'm not sure how to check the error logs for the built-in PHP server?
Thanks again for your help! |
Welcome Guest, Not a member yet? Register Sign In |