Questions tagged [bootstrapping]

Use it for questions about the operations done from Drupal to initialize itself, not about Twitter Bootstrap.

Filter by
Sorted by
Tagged with
125 votes
14 answers
19k views

What is the basic concept behind hooks?

I am intermediate in PHP. To polish my skills I start learning Drupal 7. While learning Drupal architecture concepts, the terms hooks and bootstrapping puzzled me a lot. I read the "Pro Drupal ...
GiLL's user avatar
  • 1,733
16 votes
4 answers
14k views

Properly bootstrap drupal for standalone PHP file?

This is what I have right now: <?php define('DRUPAL_ROOT', '/var/www/clients/client1/web15/web'); include_once(DRUPAL_ROOT . '/includes/bootstrap.inc'); drupal_bootstrap(...
Joren's user avatar
  • 2,440
15 votes
5 answers
8k views

Bootstrap from external script

I am trying to create Drupal entity instances from an external script that is not part of Drupal or a Drupal module. For Drupal 7 there was drupal_bootstrap to load the required Drupal dependencies. ...
sleidig's user avatar
  • 543
10 votes
3 answers
4k views

Caching the Drupal bootstrap

I'm curious if anyone has made attempts to "cache" the bootstrap process in Drupal. Normally, Drupal will run the 7 bootstrap phases on each request, but perhaps on a deployed production system, one ...
Letharion's user avatar
  • 27.5k
8 votes
3 answers
2k views

Site performance , cache not working properly

I am using the Performance Logging Module. Above screenshot, one strange thing I noticed that Insert Cache_bootstrap on every page. When you go to any page (both admin theme and frontend theme) Insert ...
Jalil Khan's user avatar
8 votes
1 answer
5k views

create multilingual node programmatically

i'm trying to create a multilingual node using a php script. I'm doing this: $node = new stdClass(); $node->title = "Test ".mktime(); $node->type = "job"; $node->language = 'de'; // Or ...
caspermc's user avatar
  • 447
5 votes
2 answers
4k views

using drupal sessions during hook_boot

When a user calls the front page of our site we want to check the country from which the user is surfing and redirect the user directly to the country specific front page. We chose to use the ...
Matthias's user avatar
  • 163
4 votes
2 answers
5k views

How to code custom 404 error handling?

I was planning on using a new domain name when migrating my legacy site to Drupal. I already have the php script that will translate old urls into Drupal Urls (I'm not using pathauto for that). Now ...
uwe's user avatar
  • 12k
4 votes
1 answer
6k views

Drupal 7: Database select query FROM cache_bootstrap brings server down

The below query occasionally takes up to 24 sec and consumes the complete server resources. SELECT cid, data, created, expire, serialized FROM cache_bootstrap WHERE cid IN ('variables'); I was ...
criscom's user avatar
  • 133
3 votes
3 answers
9k views

How to call drupal_bootstrap from custom file in subfolder?

I'm trying to call drupal_bootstrap from 'temp.php' in a subfolder called 'custom' my code as follow: chdir('../'); define('DRUPAL_ROOT', getcwd()); require_once DRUPAL_ROOT . '/includes/bootstrap....
Aboodred1's user avatar
  • 2,806
3 votes
1 answer
114 views

What does the term 'Bootstrap' mean?

Referring to https://www.drupal.org/project/health_check I am confused as to what 'If Drupal fails to bootstrap' means. What is term 'bootstrap' referring to? Does it make a database call? From what ...
Donna Delour's user avatar
3 votes
1 answer
120 views

Why does DRUPAL_BOOTSTRAP_PAGE_CACHE phase come before DRUPAL_BOOTSTRAP_DATABASE?

According to this article about drupal_bootstrap function, all parameters for drupal_bootstrap() run sequentially. And if we see the sequence, here first comes - DRUPAL_BOOTSTRAP_CONFIGURATION, second ...
Sugandh Khanna's user avatar
3 votes
1 answer
781 views

How can I bootstrap my site from an external script?

Community asked.. Please clarify your specific problem... Fair comment. What I'd like help with is how do I correct the script below so it works with D9. <?php use Drupal\Core\DrupalKernel; $...
peter300's user avatar
3 votes
1 answer
162 views

When should the second drupal_bootstrap() parameter be used?

The parameters accepted from drupal_bootstrap() are two; the second is defined as follows: $new_phase: A boolean, set to FALSE if calling drupal_bootstrap() from inside a function called from ...
apaderno's user avatar
  • 97.4k
2 votes
2 answers
2k views

Drush command needs higher bootstrap level - Pantheon Drush Alias Setup

I just setup pantheon for one of my websites. So far I've done the following and the site works fine: Version Drush: 5.3 Local Dev: Ubuntu 12.04 Git clone the repo to my local desktop Copy the ...
Patoshi パトシ's user avatar
2 votes
2 answers
2k views

Bootstrapping Drupal from the command line

Here is what I'm trying to do : Write a php script that import external data into drupal. Run that script every night with a cron that executes it using php, not wget. In other words, I need my ...
Sebastien F.'s user avatar
2 votes
2 answers
356 views

Avoid drupal bootstrap for each image styles in private filesystem

Consider a scenario, where large number of images are attached to a node and they are displayed as thumbnail gallery when that node is displayed/rendered. The node has access control so it displayed ...
amit's user avatar
  • 444
2 votes
1 answer
563 views

Drush minimal bootstrap only for variables for vget

How do you make drush bootstrap minimal. How do you specify the bootstrap method like DRUPAL_BOOTSTRAP_VARIABLES, DRUPAL_BOOTSTRAP_CONFIGURATION in the drush command? Background: I just want to have ...
Dinesh Kumar Sarangapani's user avatar
2 votes
1 answer
2k views

How do I check the current user session?

In Drupal 7, I was able to use bootstrap.inc in an external PHP script, which was a custom set of pages that simply bootstrapped Drupal to check the user was logged in Drupal. The following code is a ...
tremor's user avatar
  • 133
2 votes
1 answer
916 views

Error: Class 'Drupal' not found in bootstrap.inc

Please tell me what I'm doing wrong. I'm unable to run drush, see error below: [~/public_html/d8]# drush -d status Bootstrap to phase 0. [0.01 sec, 1.86 MB] [bootstrap] ...
akeimou's user avatar
  • 23
2 votes
3 answers
2k views

Drupal bootstrap running from command line

I am using Drupal 7 functions externally, and I followed this tutorial for using Drupal functions externally; it works perfectly. In test.php file I have loaded/included Drupal bootstrap. When I ...
Javed Gardezi's user avatar
2 votes
1 answer
408 views

How to bootstrap a custom script and retrieve the session object?

I'm writing a custom script that requires a proper Drupal 8 user session to work. This is the current version: <?php use Drupal\Core\DrupalKernel; use Symfony\Component\HttpFoundation\Request; $...
Koala Yeung's user avatar
2 votes
4 answers
2k views

"Class 'PHPMailer' not found in /home/mysite/www/sites/all/modules/phpmailer/includes/phpmailer.class.inc on line 12" [closed]

I tried to work on my security parameters on drupal... I went into the security page on drupal and chmod 664 the following folders: themes, modules, cache, site, profiles and include. Simultaneously, ...
Ryan's user avatar
  • 57
2 votes
1 answer
609 views

How to add margin between columns with Drupal Bootstrap View Grid [closed]

I need help I'm trying to add some margin between columns using drupal Views Bootstrap module the grid view but the columns are closed together. How can I add margin between columns. I have tried ...
John's user avatar
  • 31
2 votes
1 answer
111 views

What is the scope of the drupal session cookie?

I am bootstrapping drupal 7 (using DRUPAL_BOOTSTRAP_FULL) so that I can use drupal's authentication/security features in the rapid development of a web app I'm doing a proof of concept for. (And yes I ...
Steve's user avatar
  • 21
2 votes
1 answer
695 views

Theme template.php functions after bootstrap

I'm trying to print a drupal menu outside drupal. In order to achieve this I ran the bootstrap as follows: drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); And I render my menu as follows: public static ...
JNDPNT's user avatar
  • 121
2 votes
1 answer
269 views

How to build an Isolated Drupal instance for testing

In order to run DrupalWebTests on travis-ci, I need to build a new Drupal instance where these tests are ran. Typically, one runs these tests with drush -l http://localhost.example test-run SomeTest ...
berkes's user avatar
  • 3,100
1 vote
1 answer
2k views

What is the first function read by Drupal in a custom module?

I've got a custom module working fine in Drupal 7. In some pages, I have parameters in the URL that I'd like to get in order to perform certain actions. For example, if a=logout or a=forgot_password ...
Axel's user avatar
  • 158
1 vote
3 answers
386 views

When is it appropriate to run a drupal_bootstrap?

I have a static site with a drupal blog in a subfolder and I want to bring the latest posts into the homepage. I can run a drupal_bootstrap and then load the nodes I want. Is this an ok strategy? When ...
Andrew Welch's user avatar
  • 2,601
1 vote
2 answers
328 views

When/where to include my own function library (like common.inc)?

When, hence where, should I include my own library of functions that I will use throughout my whole project. Drupal has it's common.inc that is included in drupal_bootstrap during the fase ...
Dawied's user avatar
  • 131
1 vote
1 answer
174 views

How to load aggregated styles / js in an 'external' script via DRUPAL_BOOTSTRAP_FULL?

I have an external script / php application that I now have to implement into a running D7 site. So far DRUPAL_BOOTSTRAP_FULL seems to do the job just fine – I can read the session, check the user etc....
tillinberlin's user avatar
  • 1,110
1 vote
2 answers
178 views

Drupal as a RestAPI

I have been using Drupal for a while to build medium to large CMS systems; love it. From time to time I have to build a RestAPI. Usually I use either Laravel, Lumen or Slim. The only reason why I ...
JP Dippenaar's user avatar
1 vote
4 answers
1k views

Can't access global user object after drupal_bootstrap

I have a stand-alone php script with the following lines at the beginning: define('DRUPAL_ROOT', '../../../../../'); require_once DRUPAL_ROOT . '/includes/bootstrap.inc'; drupal_bootstrap(...
Cameron Ball's user avatar
1 vote
1 answer
46 views

How to affect kernel request hostname when bootstrapping from custom PHP script

I'm bootstraping from a custom PHP script using: $autoloader = require_once 'web/autoload.php'; $request = Request::create('/'); // $_SERVER['SERVER_NAME'] = 'whatever'; // $request->server->...
cherouvim's user avatar
  • 1,937
1 vote
1 answer
220 views

Problem with table schema

I'm working on an API that pulls data from a Drupal site. Everything has gone pretty well I normally use Drupal Bootstrap to load Drupal use the functions I need then spit out a JSON array. I am ...
Pitchinnate's user avatar
1 vote
3 answers
3k views

Loading bootstrap.inc in external PHP file in a subdirectory

I'm trying to check if there is a user logged into drupal in a PHP script that resides within a subdirectory of the drupal root. I know that there can be issues with calling the bootstrap anywhere ...
Andy's user avatar
  • 775
1 vote
2 answers
428 views

Creating nodes and interacting with drupal from the command line

I have a requirement where I will have to insert content (nodes) from the command line. I know that drupal bootstraping is needed to acces the environment, and this can be done using PHP. Is there ...
drcelus's user avatar
  • 1,662
1 vote
1 answer
76 views

From where the execution starts in Drupal

Generally in any HTML file execution starts from index.html and PHP file starts from index.php. But in Drupal from which file the execution is started, i know that it is started from bootstrap file ...
drupalninja's user avatar
1 vote
1 answer
423 views

Programmatically log in a user

I am trying to authenticate users as below. I don't get any error, but it doesn't log in users. autoLogin.php is located in the root folder. Visiting http://example.com/drupal8/autoLogin.php shows me ...
likeachamp's user avatar
1 vote
1 answer
250 views

How can I bootstrap a multi-site instance?

It's possible to bootstrap Drupal 8 and create a new node using answer # 174474. define('DRUPAL_DIR', '/usr/share/nginx/html'); use Drupal\Core\DrupalKernel; use Symfony\Component\HttpFoundation\...
Ch4mb3rs's user avatar
1 vote
1 answer
210 views

Script exits on drupal_bootstrap_full when run from system cron

I have a script that imports data into custom entities created in a drupal 7 database. It needs to run daily so i've added it to my system crontab (running CentOS 6.7). The problem i am having is that ...
Lindsay Mickey's user avatar
1 vote
1 answer
265 views

Is it possible to have an external script run index.php that bootstraps Drupal?

It seems like such a simple question, and I apologize for my Drupal ignorance, but I am unable to get our Drupal contractors to accomplish what seems to be a simple request. I need the below script ...
GDP's user avatar
  • 115
1 vote
1 answer
382 views

Why Drupal changes the module (system table) bootstrap value after i set it with an SQL query?

I need to run some hooks very early in the boostrap like enhanced_page_cache does. I copied the same hook_update to set my module as available in Drupal bootstrap and alter its weight. /** * Ensure ...
Pan Chrono's user avatar
  • 1,943
1 vote
4 answers
1k views

drupal 7 error: table blocked_ips not found

I have a running Drupal 7 site and wanted to restore it locally on development computer. But on localhost I keep receiving white screen in Firefox or Internal Server Error code 500 on Chrome. ...
camcam's user avatar
  • 2,111
1 vote
2 answers
841 views

"No Drupal site found" -- Windows and SQL Server

So I'm trying to upgrade our system from using Drush 6 to Drush 8, as that is the currently supported version of Drush that supports Drupal 7. I have managed to get drush working, however it does not ...
Arak Tai'Roth's user avatar
1 vote
1 answer
162 views

Breadcrumb add content type data without any modules

How could I print content type like the breadcrumb, for example Home/Content type/Create
tamilselvancst's user avatar
1 vote
0 answers
102 views

How to boostrap Drush from within an update hook?

I have a drush command I am using to convert field_collection to multifield. /** * Convert Field Collection to Multifield. */ function mvpd_update_7018() { module_load_include('inc', 'multifield'...
Elijah Lynn's user avatar
1 vote
0 answers
25 views

How to fix this issue in drupal7 using windows [duplicate]

How to fix this issue ? Fatal error: require_once(): Failed opening required '/var/www/.../includes/sites/all/modules/entity/includes/entity.inc' (include_path='.:') in /var/www/.../includes/...
Ankit Kumar Rathore's user avatar
1 vote
0 answers
110 views

Redirect After Creating a Node - bootstrap.inc

I wanted to create a node from a standalone php file bootstrapping drupal. I printed out the form and it creates a node perfectly but it doesn't redirect to the created page or any other page for that-...
Ibrahim's user avatar
  • 21
1 vote
1 answer
67 views

Database corrupted getting the site crash

I crashed my website trying to secure it by changing files and folders modifications...After i tried many things (chmod 777 -temporarly- all to take it back, clear the cache, drush rr...) nothing ...
Ryan's user avatar
  • 57