I'm trying to provision a CentOS box using Vagrant and Chef Solo. I've specified some attributes I would like the apache2 cookbook to use but it does not appear to be using them.
Here's what I've added in my Vagrantfile:
chef.json.merge!(
'apache2' => {
'user' => 'testuser',
'group' => 'testgroup',
'dir' => '/custom',
'log_dir' => '/custom/logs/http',
'default_site_enabled' => false
}
)
chef.add_recipe "apache2"
Yet, after running vagrant up the apache cookbook has ignored all of the attributes I've specified. I've tried using both apache and apache2 as the key.
Am I missing something simple? Thanks!
This should merge the attributes into the node.
chef.json = {
'apache2' => {
'user' => 'testuser',
'group' => 'testgroup',
'dir' => '/custom',
'log_dir' => '/custom/logs/http',
'default_site_enabled' => false
}
}
And this is how you would access it.
node['apache2']['user'] # => testuser
Related
Upgraded CakePHP from 3.5 -> 3.6 -> 3.7. The error message, Property _transportConfig does not exist, is displayed as soon as the application starts in the browser.
Email Transport config in app.php
'EmailTransport' => [
'default' => [
'className' => 'Smtp',
'host' => 'smtp.gmail.com',
'port' => 587,
'username' => '*******#gmail.com',
'password' => '********************',
'log' => true,
'tls' => true
],
],
I've found some information in the migration guide, here is a solution that may work;
First, you need to add this to your bootstrap file
use Cake\Mailer\TransportFactory;
then replace
Email::setConfigTransport(Configure::consume('EmailTransport'));
by
TransportFactory::setConfig(Configure::consume('EmailTransport'));
finally you might consider updating the debugger via composer :
λ composer require --update-with-dependencies "cakephp/debug_kit"
Might not be the best way to, but it worked for me!
DebugKit Toolbar do not show at the top-right of my localhost/thegioididong page.
Try:
bin/cake plugin assets symlink
to load debugkit assets.
SOLVED! I do these thing:
1: check the debug status at the top of config\app.php.
`'debug' => filter_var(env('DEBUG', true), FILTER_VALIDATE_BOOLEAN),`
2: add to the end of config\bootstrap.php these codes:
`if (Configure::read('debug')) {
Plugin::load('DebugKit', ['bootstrap' => true]);
}`
3: create debug_kit table in mysql database - leave it empty database (localhost/phpmyadmin - in my case), then add:
'debug_kit' => [
'className' => 'Cake\Database\Connection',
'driver' => 'Cake\Database\Driver\Mysql',
'persistent' => false,
'host' => 'localhost',
'username' => 'root',
'password' => 'root1234',
'database' => 'debug_kit', //leave it empty - without tables
'encoding' => 'utf8',
'timezone' => 'UTC',
'flags' => [],
'cacheMetadata' => true,
'log' => false,
'quoteIdentifiers' => false,
'url' => env('DATABASE_URL', null),
],
into config\app.php following this structure:
'Datasources' => [
'default' => [
//default database config here
],
'debug_kit' => [
//debug_kit database config as above
],
'test' => [
//test database config here
],
],
Thanks a lot. I'm sory for my English!
in my case cake 3.5 this lines of code work
if (Configure::read('debug')) {
Configure::write('DebugKit', ['forceEnable' => true]);
Plugin::load('DebugKit', ['bootstrap' => true]);
}
add this line at the end of bootstrap.php
Do you have this in your bootstrap.php file?
if (Configure::read('debug')) {
Plugin::load('DebugKit', ['bootstrap' => true]);
}
enabled sqlite, for linux mint
nano /etc/php/7.2/apache2/php.ini
uncomment
extension=sqlite3
restart apache
service service apache2 restart
For CakePHP 3.x:
Check if "debug" is set to true. You may add debug('test'); somewhere in your app and check if you see the word "test" in your website's code at the beginning.
Check that debugkit plugin is loaded by adding debug(Plugin::loaded('DebugKit')); at the end of bootstrap.php. This should echo "true".
Add Configure::write('DebugKit', ['forceEnable' => true]); before you load DebugKit.
Add your development TLD to the "safeTld" property. (thanks #mark)
// Allow e.g. http://foo.bar.dev or http://my-shop.local domains locally
Configure::write('DebugKit.safeTld', ['dev', 'local', 'example']);
Copy or symlink asset plugins running bin/cake plugin assets symlink (use copy on windows)
Docs here.
Make sure you have sqlite extension installed. If you're using Laragon, enable Sqlite extensions in Menu > PHP > Extensions (this is what fixed my issue).
I am using Cakephp 3 and MSSQLSRV 2014. I made all the necessary changes to connect to MSSQL server. In GUI, I can see that cakephp can connect to MSSQL. Please see the below screenshot.
So now when I go to bin directory to bake the application, I get below error unable to load MSSQL driver, which is already installed:
Here are my datasource settings in app.php file:
'Datasources' => [
'default' => [
'className' => 'Cake\Database\Connection',
'driver' => 'Cake\Database\Driver\Sqlserver',
'persistent' => false,
'host' => 'localhost\SQLEXPRESS',
/**
* CakePHP will use the default DB port based on the driver selected
* MySQL on MAMP uses port 8889, MAMP users will want to uncomment
* the following line and set the port accordingly
*/
'port' => '1433',
'username' => 'sa',
'password' => 'password',
'database' => 'ServerMatrix',
'encoding' => 65001,
'timezone' => 'UTC',
'cacheMetadata' => true,
'log' => false,
I am thinking its probably a bug that should be reported to CakePHP community, but wanted to get some help from stack-overflow community to see if they have encountered such issue.
In command line interface typed php --ini and opened loaded php.ini file and added SQLSrv extensions. That solved the problem for baking an application.
Thanks to #ndm.
So I have a vhost config in my puppet manifest file
apache::vhost { 'site.dev':
port => '80',
docroot => '/home/vagrant/projects/Personal/php/site/public',
serveradmin => 'admin#admin.dev',
options => ['Indexes','FollowSymLinks','MultiViews'],
setenv => ["APP_ENV dev"],
override => ['All'],
}
Now I want to add these options
EnableSendfile Off
EnableMMAP Off
I googled and found that concat::fragment might just be what I need, so I tried the following:
concat::fragment { "site.dev-static":
target => '25-site.dev.conf',
order => '01',
content => '
EnableSendfile Off
EnableMMAP Off
',
}
NOTE
In the target I have also tried with the full path: /etc/apache2/sites-available/25-site.dev.conf (with same results)
When I do vagrant provision I get this:
-- snip --
==> acs_dev: Warning: Scope(Concat::Fragment[Listen 80]): The $ensure parameter to concat::fragment is deprecated and has no effect.
-- snip --
I assume this worked fine but when I go to the vhos file at /etc/apache2/sites-available/25-site.dev.conf the EnableSendfile and EnableMMAP are not there.
I am using version 2.0.0 of puppetlabs concat module.
What do I need to do to make this work??
UPDATE
Apparently I could have just used
custom_fragment
In the vhost code. Don't know why this doesn't appear first in the module documentation.
You can add custom fragments in the vhost code like so:
apache::vhost { 'foo':
port => '80',
ip => '127.0.0.1',
add_listen => false,
proxy_pass => [
{
'path' => '/',
'url' => "http://127.0.0.1:8080",
'reverse_urls' => "http://127.0.0.1:8080",
},
],
docroot => '/var/www/html',
custom_fragment => '# Fragment content',
}
I also find that using the template function makes it easier to manage the content if it's a long fragment:
custom_fragment => template('apache_profile/etc/httpd/apache_custom_fragment.erb'),
The custom_fragment parameter is documented in the README.md
I am using following directory structure in Wamp server and i am getting an error Fatal error: Class 'Application_Model_ClassName' not found:
www--->pnp--->client--->application
--->controllers
--->modules
--->models
--->docs
--->library
--->public
--->.htaccess
--->.buildpath
But when i remove client directory from the above structure its working fine. With the following structure its working fine.
www--->pnp--->application
--->controllers
--->modules
--->models
--->docs
--->library
--->public
--->.htaccess
--->.buildpath
Please suggest, so that i can use client or dev or qa directory.
We need to autoload model files in the the Bootstrap.php, with the following code.
protected function _initAutoLoad ()
{
$autoLoader = Zend_Loader_Autoloader::getInstance();
$resourceLoader = new Zend_Loader_Autoloader_Resource(
array('basePath' => APPLICATION_PATH, 'namespace' => 'Application',
'resourceTypes' => array(
'form' => array('path' => 'forms/', 'namespace' => 'Form'),
'model' => array('path' => 'models/', 'namespace' => 'Model'))));
return $autoLoader;
}