# Brain imploding trying to get bedrock + bedrock-ansible running... please help

**URL:** https://discourse.roots.io/t/brain-imploding-trying-to-get-bedrock-bedrock-ansible-running-please-help/3592
**Category:** bedrock
**Created:** 2015-04-24T04:37:04Z
**Posts:** 25

## Post 1 by @timichango — 2015-04-24T04:37:04Z

So — after building 2 projects with Sage (loving it), I’m finding that deploying sage using my old workflow (ie. just cramming all compiled code/image assets into git and using beanstalkapp to fart them out to staging/production servers) doesn’t work (/dist/ being .gitignored…) — and consequently I’ve started trying to play around with bedrock (hoping that it’ll help with deployment), and bedrock-ansible (in-lieu of my previous puphpet/vagrant setup).

But — try as I might — I just can’t get it working properly, and I feel like I’m just bleeding time trying to figure out how the hell to start working with a bedrock-ansible + bedrock setup.

I’m on OS X, btw.

What I’ve done so far:

- create project root `~/sample/`
- git clone bedrock-ansible into `~/sample/bedrock-ansible`
- git clone bedrock into `~/sample/sample.com`
- configure `group_vars/development` with my wp configuration preferences
- vagrant up

…aaaaand… immediately, problems.

1. Getting a php error: `Notice: Constant MULTISITE already defined in /srv/www/sample.com/current/web/wp-config.php on line 10`. This can be resolved by killing the multisite declaration in wp-config, but then I can’t test how that’s affecting the status of the multisite activation, due to issue #2…

2. The wp site admin login user/pass I’ve configured in `group_vars/development` doesn’t work, at all. No matter what I try, I can’t log into WP.

3. wp-cli _doesn’t work at all_, either from `~/sample/sample.com/web/wp` OR from within the vagrant box, run from `/srv/www/sample.com/current/` — with different errors… running from inside the vm gives me `PHP Warning: Unterminated comment starting line 16 in phar:///usr/bin/wp/php/wp-cli.php(23) : eval()'d code on line 16`, and running from the host gives me a DB connection error. **Bottom line:** with wp-cli crippled, there’s no way to add another user with a password that I can actually log into WP with.

4. My last hail-mary to get a user set up in the DB was to try connecting to the vagrant-ansible vm , but I can’t for the life of me figure out how the heck to get sequel pro to connect to the vm db.

So… what the heck am I doing wrong?! I’m going nuts here.

Sincere thanks in advance for help on any/all of these issues.

---

## Post 2 by @fullyint — 2015-04-24T04:52:00Z

Connecting to your local VM DB via Sequel Pro

- enter username and password from `group_vars/development`
- if you changed IP from `Vagrantfile` you’ll need to change it here

![](https://discourse.roots.io/uploads/default/1908/a03f2ce1e48d7e96.png)

---

## Post 3 by @fullyint — 2015-04-24T04:57:20Z

I heard a cool guy mention the [multisite wiki](https://github.com/roots/bedrock-ansible/wiki/Multisite) once, in case your intention is multisite.

---

## Post 4 by @timichango — 2015-04-24T05:09:07Z

Well, I’ll be… 5+ hours of googling and tearing out hair didn’t turn that up… I’ll take a look-see.

Wonder if _not_ having the wp-config multisite rules in place in wp-config would have anything do do with the user login not getting properly configured?

I’d assumed that setting multisite: true in the `group_vars/deployment` config would’ve handled that setup.

---

## Post 5 by @timichango — 2015-04-24T05:12:40Z

Actually: just finished running another bedrock + bedrock-ansible test from scratch in a new root using the default configuration (for example.dev, non-multisite), and while that one predictably doesn’t have the multisite error, it also doesn’t provision the admin/admin user/login correctly, and I can’t log in.

Any thoughts on why ansible’s not properly setting up the user account on the initial vagrant up?

---

## Post 6 by @timichango — 2015-04-24T05:29:03Z

Argh.

Managed to connect via sequel pro using your instructions (massive thanks for that!), and even after setting a new password using:

```
UPDATE (wp_users) SET user_pass = MD5('pork') WHERE ID = (1);
```

…I still can’t log in. This is baffling.

I just keep getting presented with a fresh login screen at…

```
http://example.dev/wp/wp-login.php?redirect_to=http%3A%2F%2Fexample.dev%2Fwp-admin%2F&reauth=1
```

The `reauth=1` arg in that URL is making me think that somehow the ansible/bedrock wp install isn’t setting the proper login cookie(s)?

---

## Post 7 by @fullyint — 2015-04-24T05:35:14Z

Strange. This area isn’t my expertise (as if anything were my epertise!). But I haven’t heard of that login problem happening with bedrock-ansible.

- Does your install of wp-cli seem to be in working order and up-to-date?
- There weren’t any errors in the log after `vagrant up`?

---

## Post 8 by @timichango — 2015-04-24T05:43:48Z

- wp-cli is working to the best of my knowledge — was installed fresh for another project circa yesterday, and seems fine. also, presumably, when being run from inside the vm, I’d assume that wp-cli is using a copy installed on the vm itself, not my local copy. It’s perplexing.

- I’m going to guess that wp-cli commands run from the host are failing due to some kind of pathing error, but I can’t find any clarity on how to resolve that — particularly since with bedrock I’m still pretty unclear where wp-cli would even _find_ the db information to connect properly, since that’s been abstracted out of wp-config

- where would I find the log in question? I watched the vagrant up run each time and didn’t witness any explosions, but the log might show something different?

Thanks,  
T

---

## Post 9 by @fullyint — 2015-04-24T05:54:24Z

wp-cli: You’re totally right. Bedrock-ansible installs its own copy. Sorry about that.

log: I just meant the terminal output, sorry. You’d have noticed errors in red. I shouldn’t have mentioned it.

I think I’ll be better troubleshooting after some rest. Sorry.

---

## Post 10 by @timichango — 2015-04-24T05:55:14Z

I’m now officially certain that the password **IS** being setup correctly —but then getting booted out immediately after login, and sent back to the login screen.

Just tested with an incorrect password, and I get a password error. Tested with the pass configured in `group_vars/development`, on the other hand, and finally realized that it fails back to the login screen silently — no login error.

What the actual…

---

## Post 11 by @timichango — 2015-04-24T05:55:35Z

No worries, and again, sincere thanks!

---

## Post 12 by @fullyint — 2015-04-24T05:58:22Z

Not sure, but maybe the WP logs in `/srv/www/sample.com/logs` would have info.

---

## Post 13 by @kalenjohnson — 2015-04-24T06:08:59Z

This has happened to me when I had similar issues with Multisite. Clear your cache, including cookies, and I think you should be able to login.

---

## Post 14 by @timichango — 2015-04-24T06:23:50Z

I’m… getting even more perplexed.

I tried switching browsers (was using FF, so tried chrome), and I got the following:

[![](https://dl.dropboxusercontent.com/s/1twc414r5z8g09s/Screenshot%202015-04-23%2023.24.33.png?dl=0) ](https://dl.dropboxusercontent.com/s/1twc414r5z8g09s/Screenshot%202015-04-23%2023.24.33.png?dl=0)

Cookies are **most certainly not disabled**. Other non-bedrock wp sites work fine. This is bananas.

---

## Post 15 by @kalenjohnson — 2015-04-24T06:35:09Z

Is this back to a multi site install?

---

## Post 16 by @timichango — 2015-04-24T08:16:41Z

Yes — multisite.

Thankfully, I seem to have been able to make a bit of progress here, and did manage to get a multisite bedrock-ansible + bedrock installation running, and accepting login credentials. phew. Not really sure what did the trick, however, unless there’s some inherent issue with using example.dev verbatim — switching to a distinct url across the board, coupled with the steps articulated at the multisite wiki entry linked above plus god knows what else seemed to work in the end.

Still wrestling with the wp-cli stuff however. I’ll break the WP-CLI issue and some other questions I’ve got into separate discussions.

Thanks for all the help folks!

---

## Post 17 by @cmosguy — 2015-06-01T23:14:24Z

I am having the same issue. Is the only way you fixed this is by using multisite support?

Thanks!

---

## Post 18 by @40Q — 2015-06-02T02:33:07Z

Have you defined `DOMAIN_CURRENT_SITE` on your .env file and on your group\_vars/development?

Also, on your config/application.php you should have something like this somewhere in the code.

```
/**
     * Wordpress Multisite
     */
    define('WP_ALLOW_MULTISITE', true);
    define('MULTISITE', true);
    define('SUBDOMAIN_INSTALL', true); // Set to false if using subdirectories
    define('DOMAIN_CURRENT_SITE', getenv('DOMAIN_CURRENT_SITE'));
    define('PATH_CURRENT_SITE', '/');
    define('SITE_ID_CURRENT_SITE', 1);
    define('BLOG_ID_CURRENT_SITE', 1);
```

---

## Post 19 by @jchapron — 2015-06-04T13:09:34Z

Hello,

Just my two cents because I stumbled on this post having quite a similar issue yesterday.  
When trying to access `example.dev/wp-admin`, I was redirected to /wp/wp-login.php and after logging in, I was presented with the login page with the same URL as you with no message :  
`http://example.dev/wp/wp-login.php?redirect_to=http%3A%2F%2Fexample.dev%2Fwp-admin%2F&reauth=1`

What I finally did was trying to access `/wp/wp-admin` instead of `/wp-admin`, which worked.  
I hope you’re in the same case :slight_smile: !

For more informations (if this happens to be the same issue), I don’t think I encountered the issue installing bedrock-ansible on my mac but did on windows.

---

## Post 20 by @kalenjohnson — 2015-06-04T16:41:53Z

Hi jchapron, first of all, your question doesn’t really have anything to do with this thread. If you have a question, you can post your own topic.

Secondly, yes, since WordPress is installed to `wp` in a default Bedrock installation, going to `/wp/wp-admin` is the correct way to do it.

---

## Post 21 by @jchapron — 2015-06-04T20:03:35Z

Hi Kalen,

I’m truly sorry if I didn’t grasp the right topic of this thread or misused discourse in any way.  
To clarify, I wasn’t asking anything, I was trying to help @timichango with his login error.  
I noticed that the “redirect\_to” attribute in the URL he provided was to “/wp-admin”, not “/wp/wp-admin”, which redirects to /wp/wp-login with no user feedback which is what he seemed to experience.

Given your answer, I probably misunderstood the issue at stake here and I apologise once again for interfering.

---

## Post 22 by @kalenjohnson — 2015-06-04T20:22:03Z

Hey jchapron, no sorry my mistake, I thought you were asking your own question. Thank you for helping out :slight_smile:

---

## Post 23 by @erit — 2015-09-09T08:46:44Z

Thank you for this. +1 to add this to the docs.

---

## Post 24 by @RiFi2k — 2015-09-09T20:17:43Z

Or you can bypass all that which is what I normally do before provisioning and go into trellis/roles/nginx/templates and edit wordpress.conf switching out

```
location / {
  try_files $uri $uri/ /index.php?$args;
}
```

for

```
location / {
    try_files $uri $uri/ /index.php?$args;
  }
  rewrite ^/(wp-.*.php)$ /wp/$1 last;
  rewrite ^/(wp-(content|admin|includes).*) /wp/$1 last;
  location ~* ^.+\.(jpe?g|gif|js|css|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mp3)$ {
    expires 30d;
    rewrite ^/(wp-(content|admin|includes).*) /wp/$1 break;
  }
```

Then you are able to swap out in your wordpress\_sites file

```
wp_home: http://example.dev
wp_siteurl: http://example.dev/wp
```

for

```
wp_home: http://example.dev
wp_siteurl: http://example.dev
```

Then your multisite functions just like it wasn’t set up in a subfolder and it drops all instances of the /wp/ out of all your links, you can go right in between network admin and sites, I used to have to manually go in and add /wp/ into the database because it would never get confirmed right for multisite, and I would get white screens in between network and site admin areas.

Just for reference my code snippet came from

> <https://github.com/markjaquith/WordPress-Skeleton/issues/91>

I have been using it for months on multisites live and in development never a problem. Any reason you guys don’t use something like this standard? Makes it seem much more fluid in my opinion for users and admins

---

## Post 25 by @RiFi2k — 2015-09-09T20:36:16Z

Oh and for the WP-CLI errors you just need to pass --url=example.dev at the end of your command, for multisite it doesn’t know what site it is supposed to be targeting so you just tell it the root domain, then commands work as expected

Also I have found I need to be in the /web/ folder with the wp-config file, even though there is a wp-cli config file telling it where your wp-config file is, this only happens to me sometimes, 90% for the time now if it has to do with the database I just jump into mysql -u root -p and just do what I need to do because wp-cli and multisite I do not think is perfect by any means
