WordPress Local Development on OS X with Valet and Bedrock


#3

Nice one, wanted to try Valet for a while as Trellis is great but a bit overkill if you want to test something fast like a new plugin/theme or a framework.


#4

Great article thanks, @benword!


#5

I’ve had good results running this setup with Windows 10 as well. MariaDB, PHP7 and Caddy can all be downloaded and added to your PATH.

Does anyone have an optimal Caddyfile for bedrock deployments? I haven’t had a chance to look through all of their docs, but this has worked for me:

localhost:8080
root web/
gzip
fastcgi / 127.0.0.1:9000 php
rewrite {
    if {path} not_match ^\/wp\/wp-admin
    to {path} {path}/ /index.php?_url={uri}
}
tls off
errors visible


#6

I’ve given this a shot an was up and running in minutes. Super helpful for getting a quick instance up and running.


#7

Thanks for the tip. Installed it now. Do not forget to add the required directory to your path before installing valet:
export PATH=$PATH:~/.composer/vendor/bin
I forgot to run a brew services start mariadb so could not connect to database right away. Anf last but not least I got this error;

Uncaught phpmailerException: Invalid address: wordpress@.... But found out it was related to the WordPres 4.6 bug and that the installation did work out.


#8

I recently released v1.0 of my valet command for WP-CLI, which complements Laravel Valet and makes spinning up new sites a total breeze. If you’ve never heard of it, it essentially automates the whole process of creating a new local install, that’s ready to use in your browser in a matter of seconds.

Originally it only supported vanilla WP, but with 1.0 support was added for creating new Bedrock installs as well. Support for all other Valet-supported WordPress projects is also in the works (mostly just pending Valet drivers to be merged).

To create a new ready-to-use Bedrock install, simply run:

wp valet new my-project --project=bedrock

With cached dependencies, the install is really fast…

You can install the package w/ WP-CLI right now with

wp package install aaemnnosttv/wp-cli-valet-command:^1.0

Or check it out on GitHub :eyeglasses:


#9

I ran into a similar issue as alkymst when trying to get Valet running on my mac.

I don’t have the exact error/warning anymore but after running brew install mariadb homebrew would state something about running brew unlink mysql to resolve. I also received the same output noted above by alkymst.

I followed the first section: Remove MySQL completely per The Tech Lab from this post: https://coderwall.com/p/os6woq/uninstall-all-those-broken-versions-of-mysql-and-re-install-it-with-brew-on-mac-mavericks

After running those commands and restarting my machine I was able to brew install mariadb and valet worked like a charm.


#10

How do one actually log in to the wordpress dashboard?


#11

I did everything described in the tut and when I spin up the http://new-site.dev, it just says “Just works”. Isn’t the Wordpress already installed? What do I have to do furthermore?
How can I make it available via https/SSL?

Thanks in advance! We love you guys for the awesome work :heart_eyes:


#12

The credentials are admin / admin


#13

local macOS Apache was still running and I needed to restart valet then again - wow it works great!


#15

If you want https/ssl, you’ll need to create a certificate for your localhost

This post was helpful.

Basically it follow this guide and then you add the cert location to the browsersync options


#16

Has anyone had any luck with changing the max upload size for sites set up with Valet? It seems to be set at 8MB.

Steps I’ve tried:

  1. Editing /usr/local/etc/php/7.0/php.ini
  2. Editing the WordPress function.php file
  3. Last ditch attempt was using various plugins but as expected, they get ignored

Any ideas?


#17

Edit your php.ini:

php -i | grep php.ini
Configuration File (php.ini) Path => /usr/local/etc/php/7.0
Loaded Configuration File => /usr/local/etc/php/7.0/php.ini

So then edit the php.ini found there at:

/usr/local/etc/php/7.0/php.ini

and edit

upload_max_filesize = 32M

line and use the limitation needed.


#18

Thanks for posting that up @jasperfrumau. Sadly I’ve already tried this to no avail.


#19

Just installed Valet 2 (released a few days ago) and they’ve switched over from Caddy to Nginx. As a result, I’ve been able to add client_max_body_size 100m; to my global nginx.conf (located at /usr/local/etc/nginx/nginx.conf). Just restart nginx and good to go :slight_smile:


#20

Glad to hear that! Having issues with the latest Laravel Valet version and wp valet itself - ticket myself. May be another Valet 2.x issue. Hitting 404s now.


#21

I was having some issues after upgrading but I ended up performing a full restart of the computer and everything worked fine for me after.

Looking at the ticket you linked to, is your URL https://video-tuts.localhost? Did you manually change your domain over to .localhost? I read that you’ll need to manually set that again after the upgrade. Not sure if you did that yet? Also, did you re-park your sites directory?


#22

Hmm, I set the domain again. No change. Then I restarted once more and then I removed the installation and added a new one and now it seems to load just fine :smile:


#23

Hmm. home loads and all frontend pages, but now issues with the /wp/ backend pages.

2016/12/12 20:01:40 [error] 2609#0: *21 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1, server: video-tuts.localhost, request: "GET /wp/wp-login.php HTTP/2.0", upstream: "fastcgi://unix:/Users/jasper/.valet/valet.sock:", host: "video-tuts.localhost"

Will test some more again tomorrow.