Problems with Vagrant + CakePHP + CentOS 7.1

Asked 2 years ago, Updated 2 years ago, 121 views

I was trying to create a local development environment by installing CakePHP from Composer in Vagrant, but the situation was the same as below.

CakePHP cache was disabled to write in Centos7
I deployed CakePHP 2.6 in EC2 of AWS, but the error persists.

I tried to change the permissions of the file to chmod777-Rtemp, but the error did not disappear.

Uncaught exception 'CacheException' with message 
'Cache engine'_cake_core_" is not properly configured.
Ensure required extensions are installed, and credentials/permissions are correct' in/webroot/hoge/Vendor/cakephp/lib/Cake/Cache/Cache.php: 186
Stack trace:
#0/webroot/hoge/Vendor/cakephp/cakephp/lib/Cake/Cache.php(151): Cache::_buildEngine('_cake_core_')
#1/webroot/hoge/App/Config/core.php(354): Cache::config('_cake_core_', Array)
#2/webroot/hoge/Vendor/cakephp/cakephp/lib/Cake/Core/Configure.php(72): include('/webroot/hoge...')
#3/webroot/hoge/Vendor/cakephp/cakephp/lib/cake/bootstrap.php(431): Configure::bootstrap(true)
#4/webroot/hoge/App/webroot/index.php(98): include('/webroot/hoge...')
#5 {main}
brown in/webroot/hoge/Vendor/cakephp/cakephp/lib/Cake/Cache.php on line 186

The development environment is

  • centOS 7.1
  • CakePHP2.X

In most cases, chmod seems to have avoided it, but in my case, there may be some difference, so please let me know if anyone knows the solution in the same situation.

Note: We are building our environment with the following settings:

Vagratnfile

#-*-mode:ruby-*-
# vi:set ft=ruby:

Vagrant.configure(2) do | config |
  config.vm.define "hoge" do | node |
    node.vm.box="bento/centos-7.1"
    node.vm.hostname="hoge"
    node.vm.network:private_network, ip:"192.168.33.61"
    node.vm.network:public_network,ip:"192.168.11.61"
    node.vm.provision "ansable" do | answer |
      available.playbook="playbook.yml"
    end
    node.vm.synced_folder"./webroot", "/webroot", type: "nfs", mount_options: ["async", "nolock", "nfsvers=3", "vers=3", "tcp", "noatime", "soft", "rsize=8192", "wsize=8192 ]
  end

end

composer.json file

{
    "name": "hoge",
    prepositions [:[
        {
            "type": "pear",
            "url": "http://pear.cakephp.org"
        }
    ],
    "require": {
        "cakephp/cakephp": ">=2.4.9",
        "cakedc/search": "dev-master"
    },
    "require-dev": {
        "phpunit/phpunit": "3.7.*",
        "cakephp/debug_kit": "2.2.*"
    },
    "config": {
        "vendor-dir": "Vendor of"
    }
}

core.php

Cache::config('_cake_core_',array(
    'engine' = > $engine,
    'prefix' = > $prefix. 'cake_core_',
    'path' = > CACHE. 'persistent'.DS,
    'serialize'=>($engine==='File'),
    'duration' = > $duration,
    'mask' = > 0777,
));

Cache::config('_cake_model_',array(
    'engine' = > $engine,
    'prefix' = > $prefix. 'cake_model_',
    'path' = > CACHE. 'models'.DS,
    'serialize'=>($engine==='File'),
    'duration' = > $duration,
    'mask' = > 0777,
));

cakephp centos vagrant

2022-09-30 19:43

1 Answers

Self-resolved.

Talk about permissions in the vagrant shared folder

Apparently, the shared folder in the vagrant cannot be changed by the command.

Therefore, I will use the Vagrantfile as the content of the article

node.vm.synced_folder"./", "/vagrant",
    —owner=>"apache",
    —group=>"apache",
    :mount_options=>["dmode=775, fmode=775" ]

and reloaded to successfully create a local development environment.


2022-09-30 19:43

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.