Pages

Thursday 10 August 2017

Laravel Basic Error

[:error] PHP Parse error:  syntax error, unexpected '.', expecting '&' or variable (T_VARIABLE) in /var/www/html/laravel/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php on line 444



Run this command


sudo a2dismod php5 && sudo a2enmod php5.6 && sudo service apache2 restart

----------------------------------------------------------------------------------------------------------------------------------

[:error]SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes

[:error]
[Illuminate\Database\QueryException]
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table `users`  add unique users_email_unique`(`email`))


Change in config/database.php


'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',

Tuesday 4 July 2017

Contact Form submit more than 5 times in Drupal 8

Increase flood limit and flood interval in Drupal 8

Write down function in theme file

function theme_preprocess_page(&$variables) {
    $flood_limit = 500; //Default value is 5, change to whatever suits you.
        \Drupal::configFactory()->getEditable('contact.settings')
        ->set('flood.limit', $flood_limit)
        ->save();
}

There are two option below-:

//Default value is 5, change to whatever suits you. 

$flood_limit = 500;
        \Drupal::configFactory()->getEditable('contact.settings')
        ->set('flood.limit', $flood_limit)
        ->save();



//Default value is 3600sec (1hour), change to whatever suits you

$flood_interval = 3600;
 \Drupal::configFactory()->getEditable('contact.settings')
      ->set('flood.interval', $flood_interval)
      ->save();