Hi again,
My question was answered via user "rikh" on the Laracasts.com forums.
The memcached service is not started by default on homestead. To start it, use the following command: sudo /etc/init.d/memcached start
I got today the same issue. The thing is that we have to enable memcached manually after rebooting the vm.
Does anyone know how to enable it after boot?
sudo update-rc.d memcached defaults
System start/stop links for /etc/init.d/memcached already exist.
Also removing the links didn't solve the problem:
sudo update-rc.d -f memcached remove
sudo update-rc.d memcached defaults
dimsav said:
I got today the same issue. The thing is that we have to enable memcached manually after rebooting the vm.
Does anyone know how to enable it after boot?
sudo update-rc.d memcached defaults System start/stop links for /etc/init.d/memcached already exist.
Also removing the links didn't solve the problem:
sudo update-rc.d -f memcached remove sudo update-rc.d memcached defaults
I had a problem getting memcached to auto start too. What worked for me was to edit the homestead.rb file and add a config block as shown below. Hope it helps.
# Configure All Of The Server Environment Variables
if settings.has_key?("variables")
settings["variables"].each do |var|
config.vm.provision "shell" do |s|
s.inline = "echo \"\nenv[$1] = '$2'\" >> /etc/php5/fpm/php-fpm.conf && service php5-fpm restart"
s.args = [var["key"], var["value"]]
end
end
end
#My custom commands
#Auto start memcached when provisioning box
config.vm.provision "shell" do |s|
s.inline = "sudo service memcached start"
end
I'm 11 months late, but I think this is a tidy solution that didn't show up in my search results. I added the a command to my composer.json file, in the "scripts" section like so:
"scripts": {
"post-install-cmd": [
"vagrant ssh -- sudo /etc/init.d/memcached start",
"php artisan clear-compiled",
"php artisan optimize"
],
I added line 3. The command after the -- is passed through to be run in the ssh instance. The only hiccup is when I run composer install it tells me memcached is already running, but I don't mind.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community