# Using Laravel Valet

See their docs: https://laravel.com/docs/7.x/valet

Note: Must use ".test" domains

# Configuring php

MYSQL is on homebrew

valet start

brew services start mysql@5.7

brew services stop mysql@5.7

brew services restart mysql@5.7

# Local Valet Driver

If you have a non-standard project, for example your webroot is in "public_html" instead of "public" you can easily add a LocalValetDriver.php file in the root of your project.

# Configuring mysql:

As of now (Feb. 2020) my.cnf is located under /usr/local/etc (mysql@5.7 brew formula)

If you want to create your own my.cnf to override any defaults.....

To customize mysql config place a file called .my.cnf in /Users/mikemoreaujr/.my.cnf

Mine looks like:

[mysqld]

innodb_strict_mode = 0

sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

Because of legacy database issues.

You can place global MySQL config files in a couple places on your mac including:

  • /etc/my.cnf
  • /etc/mysql/my.cnf
  • ~/.my.cnf

For some more info on how valet works: https://deliciousbrains.com/how-laravel-valet-works-exactly/ (opens new window)

I think that I mistakenly installed it. Here is how I linked it to 5.7.

brew services stop mysql

brew unlink mysql

brew link mysql@5.7 --force

mysql -V # should output 5.7.29

brew services start mysql

That wouldn't fix it for sequel pro. Spent a few hours figuring that out. If you want, we can talk about it.  Not sure you want that in this document.

# Customizing NGINX config

I had to edit the file at file:///usr/local/etc/nginx/valet/valet.conf

https://github.com/laravel/valet/issues/269#issuecomment-271928229

In order to increase the buffer size or POST requests would return a 502 bad gateway.

fastcgi_buffers 16 16k;

fastcgi_buffer_size 32k;

See also https://github.com/laravel/valet/issues/290 (opens new window)

https://github.com/laravel/valet/issues/934 (opens new window)

This may also apply to Laravel Forge servers

Update, because my changes appear to have been overridden by a valet update, I've added a custom configuration here

file:///Users/mikemoreaujr/.config/valet/Nginx/fastcgi.conf

The files contents are

fastcgi_buffers 16 16k;

fastcgi_buffer_size 32k;

I base this off of this post and comment

https://github.com/laravel/valet/issues/284#issuecomment-303317959 (opens new window)

And I hope it works in the future!

Last Updated: 3/25/2021, 6:42:18 AM