Welcome Guest, Not a member yet? Register   Sign In
Database Error while connecting from Localhost
#1

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.
Filename: core/Loader.php
Line Number: 346

Line 346 of core/Loader.php is the public function database in the attached image.

Things I've tried:
  • I've tried changing the $config["base_url'] to "http://localhost:8888/'; but I still get the same error
  • Deleting the hostname, username and password from the database.php file, still get the same error
I'm not sure why a local version can't access a database when the live site can with the same login credentials? 

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
Reply


Messages In This Thread
Database Error while connecting from Localhost - by SDillon001 - 04-08-2017, 09:08 PM



Theme © iAndrew 2016 - Forum software by © MyBB