WordPress Local Development on OS X with Valet and Bedrock

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

1 Like

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?

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.

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

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:

1 Like

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.

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?

1 Like

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:

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.

404s now seem to be related to this issue with secure urls.

I have this problem, anyone can help me?

www wp package install aaemnnosttv/wp-cli-valet-command
Installing package aaemnnosttv/wp-cli-valet-command (dev-master)
Updating /Users/giacomoalonzi/.wp-cli/packages/composer.json to require the package...
Using Composer to install the package...
---
Loading composer repositories with package information
Updating dependencies
PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in        phar:///usr/local/bin/wp/vendor/composer/composer/src/Composer/Json/JsonFile.php on line 266

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in   phar:///usr/local/bin/wp/vendor/composer/composer/src/Composer/Json/JsonFile.php on line 266

update:

Set memory_limit = 512M in php.ini solved the problem.

update 2:

this
wp valet new my-project --project=bedrock

return me this
Don't go anywhere, this should only take a second...
Error: sh: composer: command not found

in .zshrc I have this
alias composer="php /usr/local/bin/composer.phar"
export PATH="$PATH:$HOME/.composer/vendor/bin"

whats wrong? if i run composerin terminal, all works! Thank you!

Update 3:

Ok after this

curl -sS https://getcomposer.org/installer | php $ sudo mv composer.phar /usr/local/bin/composer

all works!

1 Like

this solved all mysql problem error! Thank you! @bondydaa :slight_smile:

I have it all installed and successfully pinging *.dev.

When you install a new project for example as per your article “wp valet new bedrock --project=bedrock”

I am getting

“Error: This does not seem to be a WordPress install.”

If I do a wp core download which it suggests I then get a:

“Error: ‘wp-config.php’ not found.
Either create one manually or use wp core config.”

Now I’m either being dumb here or I’m missing something. I have followed your article to the letter and it all seems to work but creating a new project doesn’t…

Is it expecting a working bedrock installation before I do anything with valet?

@andrew40 Could be related to johnpbloch/wordpress repo changes. See solution here Deploy fails : This does not seem to be a WordPress install Perhaps it is your issue with Valet too and in that case you could do the composer part of the solution. Not certain though. But certainly cannot hurt.

& after adding the required directory quit your Terminal and reopen to let it take effect :slight_smile:

Got this all installed successfully. I can navigate to bedrock.dev ok but it shows standard ‘It works’ page. I suspect its not directing to /web/. the db is installed correctly and fields populated all ok.

4 home http://bedrock.dev/wp yes

I note you specify changing the hosts file to:

Set your site vhost document root to /path/to/site/web/

How do I do that on a Mac (High Sierra)?

I had a power cut! When it came all back on it was all working as expected, which is a bit weird?

So do I have to restart any services when I do this in future bedrock installations…

Just some notes on what I did that worked:

MariaDB

The “uninstall all versions of mysql for a fresh one” solution solved this error as well:
Don't go anywhere, this should only take a second... Error: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

Here’s what I did:

  • Stopped all mysql processes I could by running things like brew services stop mariadb and mysql.server stop
  • brew remove mysql and was also prompted to run brew uninstall --force mysql
  • ran through the first list of commands from the coderwall link
  • In addition, had to run: brew uninstall mariadb
  • couldn’t find mysql with which mysql or ps aux | grep mysqld after that
  • Ran through list of commands in the second list on the coderwall link but the long command produced an error “unkown variable tmpdir”, found solution in comments to run: mysqld -initialize --verbose --user=whoami --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp instead
  • Finally ran: brew install mariadb (valet needs mariadb specifically, not mysql)

PHP

Before I knew I had to fix PHP I temporarily increased the memory limit to install the wp-cli valet command, like so: php -d memory_limit=512M "$(which wp)" package install aaemnnosttv/wp-cli-valet-command:^1.0

Instead of uninstalling all versions of PHP I made a symlink for php@7 into usr/local/bin. My command ended up looking like this:
ln -s /usr/local/Cellar/php@7.0/7.0.30/bin /usr/local/bin/php
making a symlink for mariadb did not work since I had multiple running for some reason.

Sometime during the install process I also had stop apache on OSX: sudo /usr/sbin/apachectl stop


After a while valet stopped working and I ran through these steps to get going again:
When Valet Stops Working Properly, What Do We Do? | Tom McFarlin

1 Like

I ran int the same memory problem when trying to install wp-cli-valet-command

Having installed php via homebrew I edited memory_limit = 1024M in /usr/local/etc/php/7.3/conf.d/php-memory-limits.ini, then restart php (in my case, valet restart) and, after this, I was able to install this package.

1 Like

curl -sS https://getcomposer.org/installer | php $ sudo mv composer.phar /usr/local/bin/composer throws Could not open input file: $ curl: (23) Failed writing body (0 != 16384)