Turning on wordpress and drupal debugging

WordPress

public_html/wp-config.php
Change wordpress debugging mode to true like below in wp-config.php
define(‘WP_DEBUG’, true);
or add code below
define( ‘SCRIPT_DEBUG’, true );

Drupal

sites/default/settings.php

Add below code in settings.php file.
$config[‘system.logging’][‘error_level’] = ‘verbose’;

Advertisement

How to Put Drupal 7 in Maintenance Mode

Here’s how to turn on Maintenance Mode in Drupal 7:

Step 1

  • Go to “Configuration” then “Maintenance mode”.

Step 2

  • Make sure the “Put site into maintenance mode” box is checked
  • Enter the message you want visitors to see during the interruption.
  • Click “Save configuration”.

Step 3

  • You’ll now see a message saying “The configuration options have been saved”.

Step 4

  • You will be able to browse around your site without problems but visitors who aren’t logged in will see the message above.
  • If you log yourself and can’t get back in, just add /?q=user after your site address and you’ll be back to the user login page.

Reset password in Drupal 6 & 7 from database

For drupal6

UPDATE users SET name='admin', pass=md5('drupal') WHERE uid = 1;

For drupal7
define(‘DRUPAL_ROOT’, getcwd());
require_once DRUPAL_ROOT . ‘/includes/bootstrap.inc’;
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
require_once ‘includes/password.inc’;
$pwd = user_hash_password(‘NewPassword‘);

UPDATE users SET name=’admin’, pass=’$pwd’ WHERE uid = 1;

Install drupal through command line step by step

Download and extract files

$  wget https://www.drupal.org/files/projects/drupal-x.x.tar.gz
$  tar -zxvf drupal-x.x.tar.gz

Move to root folder

$  mv drupal-x.x /var/www/html

Create the configuration file and grant permissions

In the sites/default directory, copy the default.settings.php file and rename the copied file to settings.php.

$ cp sites/default/default.settings.php sites/default/settings.php

Give the web server write privileges (666 or u=rw,g=rw,o=rw) to the configuration file.

$ chmod a+w sites/default/settings.php

Give the web server write privileges to the sites/default directory.

$ chmod a+w sites/default

Create the Drupal database

To complete the installation, you must create an empty database and a user with full access to the newly created database for Drupal to use. You can do this by command line, or through phpMyAdmin or another database client.

$ mysqladmin -u username -p create databasename

Where ‘username’ is a MySQL user which has the CREATE and GRANT privileges. MySQL will prompt for the ‘username’ database password. Next you must set the access database rights. Log in to MySQL:

$ mysql -u username -p

$ GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON databasename.* TO ‘username’@’localhost’ IDENTIFIED BY ‘password’;

Run the installation script

Point your browser to the base URL of your website

http://www.example.com

Create an .info.yml file in Drupal 8

You create the .info.yml file in the root of your theme folder. The folder should have the same name as the .info.yml file. So if your theme is named “Fluffiness” then the folder is named “fluffiness/” and the .info.yml file is named “fluffiness/fluffiness.info.yml“. If the file is present your theme will be visible in your website at Manage > Appearance (http://example.com/admin/appearance).

Example

name: Fluffiness (Required)
type: theme (Required)
description: ‘A cuddly theme that offers extra fluffiness.’ (Required)
package: Custom
core: 8.x (Required)
libraries:
– fluffiness/global-styling
stylesheets-remove:
– ‘@classy/css/layout.css’
– core/assets/vendor/normalize-css/normalize.css
regions:
header: Header
content: Content
sidebar_first: ‘Sidebar first’
footer: Footer

.info files are now .info.yml files in Drupal 8

Drupal 7

configure = admin/config/system/actions

Drupal 8

configure: action.admin

Drupal 7 ( theme_name.info )

name = Bartik
description = A flexible, recolorable theme with many regions and a responsive, mobile-first layout.
package = Core
version = VERSION
core = 7.x

; Stylesheets
stylesheets[all][] = css/layout.css
stylesheets[all][] = css/style.css
stylesheets[all][] = css/colors.css
stylesheets[print][] = css/print.css

; Regions
regions[header] = Header
regions[help] = Help
regions[page_top] = Page top
regions[page_bottom] = Page bottom
regions[highlighted] = Highlighted

regions[featured] = Featured
regions[content] = Content
regions[sidebar_first] = Sidebar first
regions[sidebar_second] = Sidebar second

regions[triptych_first] = Triptych first
regions[triptych_middle] = Triptych middle
regions[triptych_last] = Triptych last

regions[footer_firstcolumn] = Footer first column
regions[footer_secondcolumn] = Footer second column
regions[footer_thirdcolumn] = Footer third column
regions[footer_fourthcolumn] = Footer fourth column
regions[footer] = Footer

; Settings
settings[shortcut_module_link] = 0

Drupal 8( theme_name.info.yml )

name: Bartik
type: theme
description: ‘A flexible, recolorable theme with many regions and a responsive, mobile-first layout.’
package: Core
version: VERSION
core: 8.x

# Stylesheets
stylesheets:
all:
– css/layout.css
– css/style.css
– css/colors.css
print:
– css/print.css

# Regions
regions:
header: Header
help: Help
page_top: ‘Page top’
page_bottom: ‘Page bottom’
highlighted: Highlighted
featured: Featured
content: Content
sidebar_first: ‘Sidebar first’
sidebar_second: ‘Sidebar second’
triptych_first: ‘Triptych first’
triptych_middle: ‘Triptych middle’
triptych_last: ‘Triptych last’
footer_firstcolumn: ‘Footer first column’
footer_secondcolumn: ‘Footer second column’
footer_thirdcolumn: ‘Footer third column’
footer_fourthcolumn: ‘Footer fourth column’
footer: Footer

# Settings
settings:
shortcut_module_link: ‘0’