Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8986837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:38:46+00:00 2026-06-15T21:38:46+00:00

I am trying to develop a CakePHP application, and I am using Vagrant to

  • 0

I am trying to develop a CakePHP application, and I am using Vagrant to run a testing environment. However, I was getting this error in the browser

Warning (2):
  session_start() [http://php.net/function.session-start]:
    open(/var/lib/php/session/sess_speva7ghaftl8n98r9id5a7434, O_RDWR) failed:
      Permission denied (13) [CORE/Cake/Model/Datasource/CakeSession.php, line 614]

I can get rid of the error by SSHing to the vm and doing

[vagrant@myserver ~]$ sudo su -
[root@myserver ~]# chown -R vagrant. /var/lib/php/session/

I don’t want to have to do this every time I restart the vm, so I tried adding this to myserver.pp

exec { 'chown':
  command => 'chown -R vagrant. /var/lib/php/session/',
  path => '/bin',
  user => 'root'
}

but it gets an error while starting up the vm…

err:
/Stage[main]/Myserver/Exec[chown]/returns: change from notrun to 0 failed:
  chown -R vagrant. /var/lib/php/session/
  returned 1 instead of one of [0] at /tmp/vagrant-puppet/manifests/myserver.pp:35

I was unable to find any useful examples of how to use exec on the internet, and I have never used Vagrant or Puppet before, so the above code is just the best guess I could come up with, and I apologize if it is a simple fix to get this working.

I have verified using which chown within the vm that the path is /bin, and the command is exactly the same as when I run it in the vm myself. I’m thinking it is the user that is causing problem. Do I have that line right? Is it even possible to exec commands as root from a .pp file?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T21:38:47+00:00Added an answer on June 15, 2026 at 9:38 pm

    When using exec, you normally have to enter the full path to the command you execute. So if you change your command into

    exec { 'chown':
      command => '/bin/chown -R vagrant:vagrant /var/lib/php/session/',
      path => '/bin',
      user => 'root'
    }
    

    it should work imo.

    However, it depends a lot how you install your application. If the setup/start of the application is also managed with Puppet, you can also manage the directory you’re interested in with Puppet, like this

    file { "/var/lib/php/session" : 
      ensure => directory,
      group => "vagrant",
      owner => "vagrant",
      recurse => true,
    }
    

    before you start your app. This would be much more the Puppet way, as you manage a reource then instead of executing commands. However, normally /var/lib/… should not be owned by someone other than root.

    So you should maybe look into how your app is started and make it start with another user or as root. If it is started with an exec, you can add an additional property

    user => root
    

    to it and that should also do the trick.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to develop a application by using Cocos2d. I can't getting value
Trying to develop using MVVM: I have this Csla.PropertyStatus control that is created in
Im trying to develop an application in php to download pics from picasa using
I am trying to develop a system where this application allows user to book
I am trying to develop a web application using ASP.net MVC 2. For that
Trying to develop hello world, but getting force close error on emulator. thanks in
Im trying to develop an application that should show a map using the Google
Im trying to develop my first ASP.NET MVC web app and have run into
I am trying to develop an application for my localhost on which I can
I am trying to develop an application to forward received SMS to a web

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.