brew services stop php
brew services stop mysql
If /usr/local/bin/php
and /usr/local/bin/mysql
don't exist or aren't symlinked to versions 7.1 and 5.7 respectively after Valet install, explicitly link them. (Hasn't been tested with the valet-php
services.)
If Valet complained about not being able to set a root password, set it via the below. It's possible to connect to MySQL with a blank password, but Valet's built-in commands for working with database and auto-generating configuration assume the password is "root".
mysql_secure_installation
- VALIDATE PASSWORD PLUGIN: No
- Change the password for root? Yes ("root")
- Remove anonymous users? No
- Disallow root login remotely? Yes
- Remove test database and access to it? No
- Reload privilege tables now? Yes
valet park
in sites directory
Improve timeouts and concurrency in /usr/local/etc/php/7.1/php-fpm.d/www.conf
:
pm.max_children = 200
pm.start_servers = 20
pm.min_spare_servers = 10
pm.max_spare_servers = 20
pm.process_idle_timeout = 10s
pm.max_requests = 500
Make sure timeouts and memory limis are sufficient in /usr/local/etc/php/7.1/conf.d/z-performance.ini
max_execution_time = 300
memory_limit = 2G
Increase timeouts in /usr/local/etc/nginx/nginx.conf
http {
client_header_timeout 3000;
client_body_timeout 3000;
fastcgi_read_timeout 3000;
fastcgi_buffers 8 128k;
fastcgi_buffer_size 128k;
}
Restart PHP and Nginx with valet restart php nginx
echo "%admin ALL = NOPASSWD: /usr/local/bin/valet" | sudo tee /etc/sudoers.d/valet-nopasswd
{domain_name} should not include ".test"
valet secure {domain_name}
Improve timeout in ~/.valet/Nginx/{domain_name}
location ~ \.php$ {
fastcgi_read_timeout 600;
}
Restart Nginx with valet restart nginx
In project directory ({domain_name} should not include ".test"):
valet link {domain_name}
valet secure {domain_name}
Create .env.valet
in the project root w/ env variables:
<?php
return [
'{domain_name}' => [
'MAGE_RUN_CODE' => '{website_code}',
'MAGE_RUN_TYPE' => 'website',
],
];