Skip to content

Service

Description

With the service command you are able to define the state (enabled/disabled) of a service and set the default version for PHP, Composer, Xdebug, Elasticsearch, and MySQL.

Information

All changes are "install" stable. This means "valet.sh install" will not override your state or default settings.

To reduce the load on your system, its makes sense to stop all services you don't need!

Overview

list

This command shows you the state (enabled/disabled on system startup) of each service and which one is the default. To identify which services are currently started or stopped, you can use brew services list (macOS).

valet.sh service list

+----------------+-------+
|    Service     | State |
+----------------+-------+
| elasticsearch1 |   False   |
+----------------+-------+
| elasticsearch2 |   0   |
+----------------+-------+
| elasticsearch5 |   0   |
+----------------+-------+
| elasticsearch6 |   1   |
+----------------+-------+
| elasticsearch7 |   0   |
+----------------+-------+
|     php56      |   0   |
+----------------+-------+
|     php70      |   0   |
+----------------+-------+
|     php71      |   0   |
+----------------+-------+
|     php72      |   1   |
+----------------+-------+
|     php73      |   1   |
+----------------+-------+
|     php74      |   1   |
+----------------+-------+
|    mysql57     |   1   |
+----------------+-------+
|    mysql80     |   0   |
+----------------+-------+
|    mariadb104  |   0   |
+----------------+-------+
|    rabbitmq    |   0   |
+----------------+-------+
|     redis      |   1   |
+----------------+-------+
|     nginx      |   1   |
+----------------+-------+ 
+-----------------+
| Default-Service |
+-----------------+
|    composer1    |
+-----------------+
| elasticsearch6  |
+-----------------+
|     mysql57     |
+-----------------+
|      php74      |
+-----------------+
|     xdebug3     |
+-----------------+

enable

start the service and put in autostart

valet.sh service enable mysql80

disable

stops the service and remove from autostart

valet.sh service disable mysql80

start

start the service, but it will not change the behavior for autostart

valet.sh service start mysql80

stop

stop the service, but it will not change the behavior for autostart

valet.sh service stop mysql80

restart

restart the service, but it will not change the behavior for autostart

valet.sh service restart mysql80

Note

Since 2.6.3 `valet.sh service restart all restarts all enabled services!

default

set a default service. Only PHP, Elasticsearch and mysql are "defaultable" services.

valet.sh service default mysql80

  • PHP: setting a default php only changes the default php on cli. You can still use any other installed PHP versions by appending the version number, e.g. "php7.0"
  • Elasticsearch: the default elasticsearch is listening on port 9200. You can still use any other installed Elasticsearch version by accessing the version specific port (see Elasticsearch service documentation)
  • MySQL: changes the default mysql command on cli and the version listening on port 3306. You can still access any other installed MySQL versions by appending the version number, e.g "mysql5.7", or using the version specific port (see MySQL service documentation)

Warning

Setting the default version to a disabled service will not change the state of it! You have to enable the service if you want to use it