1

I'm trying to set up a Craft based site with ec2 and it won't connect with the info in db.php.

I've reinstalled the Craft files and also run all .phps through http://phpcodechecker.com to check for errors and nothing. Logs all check out to be in working order. And I've followed every step exactly with this tutorial: https://solspace.com/blog/spinning-up-a-craft-cms-development-site-on-amazon-ec2

Here's what my db.php file looks like:

return array(

    // The database server name or IP address. Usually this is 'localhost' or '127.0.0.1'.
    'server' => 'localhost',

    // The name of the database to select.
    'database' => 'Craft',

    // The database username to connect with.
    'user' => 'root',

    // The database password to connect with.
    'password' => '*******',

    // The prefix to use when naming tables. This can be no more than 5 characters.
    'tablePrefix' => "‘craft'",
);

I also checked .htaccess files.

3 Answers 3

5

So a couple of things:

  • It's probably not a great idea to connect as root -- it'd be better to create a mysql user that has access only to that db.
  • Make sure that the db you're connecting to is indeed named Craft (case may count here, I'm not sure)
  • The table_prefix looks wrong to me; probably it should be just: 'tablePrefix' => 'craft',

You also might consider checking out Multi-Environment Config for Craft CMS for multi-environment configs for Craft.

8
  • Good point about not using "root". On a local dev box it's not a big deal but as soon as you hit the cloud, all bets are off. Someone should let Solspace know about that flub... AWS users really should know better. Commented Jan 23, 2017 at 20:00
  • Thanks for the feedback guys. Ive already had the table prefix at 'tablePrefix' => 'craft', and it was apparently wrong running it through phpchecker so i read to try changing 'craft', to "'craft'", and it cleared the syntax error..
    – Tom
    Commented Jan 23, 2017 at 20:32
  • When i change the table_prefix it connects but gives me the white screen of death??!
    – Tom
    Commented Jan 23, 2017 at 20:44
  • have you tried navigation to the install url? (/admin)
    – Jan_dh
    Commented Jan 24, 2017 at 17:13
  • Yep, trying to navigate to any page just has a white blank page
    – Tom
    Commented Jan 24, 2017 at 18:30
1

I imagine you must have noticed this as your text editor would have highlighted them, but if not check your quote marks. Even if wrapping them in both quotations is intentional, you still have one that is ‘ and one that is '. They look similar but are not the same. run your code through this to clean special characters. http://www.nousphere.net/cleanspecial.php

1

If your db is on an aws rds instance you have to update the host parameter.

You can find it in the aws management console, it will be something like:

<rdsname>.<random stuff>.<region>.rds.amazonaws.com

All in all after looking at the post I would say it is fairly outdated and I wouldn't recommend it.

Read this article: https://nystudio107.com/blog/web-hosting-for-agencies-freelancers and if you're not a server guy, consider outsourcing it to forge or similar.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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