-
Tideways and Xhgui in Valet+ (Valet Plus)
This post is for folks who are already familiar with PHP, command line, Valet, Tideways and XHGui.
You can see some explanation and screenshots of Tideways and Xhgui in my Tideways and Xhgui using Dev Desktop post if you need a bit of an introduction.
I’ve successfully gotten Tideways running with Acquia Dev Desktop, Lando, and now Valet+. This post illustrates the process I used to get Tideways, Xhgui, and their dependencies running on my Mac for use in Valet+ sites.
-
Valet+ Quickstart for Drupal Development
Here’s a README.md file that I’ve developed over time. It explains how I setup and use Valet+ for quick and powerful Drupal development.
Sorry for the formatting. I’ll get markdown support on my blog sometime…
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160# Initial Valet SetupFollow official install guide at https://github.com/weprovide/valet-plus# InstallationThe following procedure is what it took to get Valet+ installed correctly on my Macbook.I had issues with MySQL not starting.# Install Valetbrew updatebrew tap henkrehorst/phpbrew install valet-php@7.2brew install composerbrew link --overwrite composerbrew install php@7.1composer global require weprovide/valet-plusvim ~/.bash_profilevalet fixvalet install# Link an appcd ~/valet/mysite/docroot/valet link mysitevalet restart# Create a databasevalet db create mysite(COMMAND FAILED; MYSQL NOT RUNNING?)valet stop# Fix MySQLbrew uninstall mysqlbrew uninstall mysql@5.7brew cleanuprm -rf /usr/local/var/mysqlrm /usr/local/etc/my.cnfbrew install mysql@5.7brew link --force mysql@5.7brew services start mysql@5.7valet fixvalet install# Create a databasevalet startvalet db create mysite# SUCCESS!----Tips:- Make a folder to store your sites `mkdir ~/valet`- Do not `valet park`. See notes below.# Site Setup (serving from ~/valet/[sitename]/docroot)1. Create site directory via `mkdir ~/valet/mysite`2. Move into it via `cd mysite`3. Use rsync/git/composer/whatever to acquire your site files --e.g., `git clone git@bitbucket.org:mysite.git .`4. Move into docroot via `cd docroot`5. Tell valet to serve a site from this folder via `valet link mysite`6. Browse to `http://mysite.test` -- if you get a DB error, that's okay for now.7. Create a new database via `valet db create mysite`. If this fails, see top of this doc!8. Existing site? Import the data with `valet db import ~/db_snapshots/mysite.sql.gz mysite`9. Update the db credentials in `sites/default/settings.local.php` -- database=mysite,username=root, password=root10. Browse to `http://mysite.test` -- hopefully it _just works_----# Explanation of Serving Sites from Docroot/Web SubdirectoriesDon't `valet park` in this `~/valet` directory. You can do itsomewhere else if you need auto-folder-to-domain functionalitywhere you create a folder and it results in having`http://folder.test` available immediately.For this `~/valet` directory we have sites that have `/docroot`subdirectories containing the actual site files, so instead of `park`,use `valet link [sitename]` from the docroot directory. This willcreate symlinks in `~/.valet/Sites` which will be accessibleat `http://sitename.test`----# Other Tips- RTFM! Valet does some amazing things. Read the docs to learn about xdebug, loggingsharing, redis, mailhog, etc.- `valet links` to view current links- `valet unlink [sitename]` to remove a link- `valet use 5.6` to change php version (5.6 7.0 7.1 7.2)- Edit `~/.valet/config.json` to set domain suffix (`.test` is default)(`valet restart` after)- Edit `~/.valet/Drivers/` to setup new drivers (shouldn't need to)(`valet restart` after maybe?)- `valet share` to share your site over the internetHit CTRL-C to stop sharing- You may not have a `$_SERVER['DOCUMENT_ROOT']` value. Until I have time to lookinto this, I'm just setting that at the top of my Drupal `settings.local.php` file.```// Manually set because Valet+ doesn't, for some reason$_SERVER['DOCUMENT_ROOT'] = '/Users/adam/valet/mysite/docroot';```- Install and enable memcached with:`brew install php71-memcached && valet restart`- Configure php with ini files at, for example, `/usr/local/etc/php/7.1/php.ini`- To generate nginx file specific to site you can:- Generate config file by securing the site: `valet secure mysite`- Copy the nginx config code in the resulting nginx file at `~/.valet/Nginx/mysite.test`- Stop here if you want to keep SSL... otherwise:- Use `valet unsecure mysite` to remove SSL (if you don't want the site served over 443)- Re-create `~/.valet/Nginx/mysite.test` with the copied code- Rework config file to serve port 80 without any SSL certs attached- To fix `upstream sent too big header while reading response header from upstream` error:- Add these lines to your `~/.valet/Nginx/mysite.test`:- `fastcgi_buffers 16 16k;`- `fastcgi_buffer_size 32k;`- NOTE: Add these to the `location ~ \.php$ {` section if you have a full nginx conf file- To fix `504 Gateway Timeout` error:- Add these lines to your `~/.valet/Nginx/mysite.test`:- `fastcgi_buffers 16 16k;`- `fastcgi_buffer_size 32k;`- `fastcgi_read_timeout 180;`- NOTE: Add these to the `location ~ \.php$ {` section if you have a full nginx conf file----# LinksValet+ Docshttps://github.com/weprovide/valet-plusParking and Linkinghttps://laravel.com/docs/5.5/valet#serving-sites