Support the ongoing development of Laravel.io →
Installation Configuration Cache
Last updated 2 years ago.
0

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

Last updated 2 years ago.
0

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
Last updated 2 years ago.
0

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
Last updated 2 years ago.
0

That was perfect. Thanks!

Last updated 2 years ago.
0

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.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

ZiadSalah ziadsalah Joined 26 May 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.