Skip to main content
Rollback to Revision 8
Source Link

I am using Drupal 9.2.7 on XAMPP 7.3.29  , with PHP 7.4.21 on Windows 10 Home.

I tried to create a custom module which allows global JavaScript and CSS (effective in all webpages in my website), by creating the root/modules/globalrs directory root/modules/globalrs with the following files.:

globalrs.info.yml

globalrs.info.yml

name: globalrs
type: module
core_version_requirement: ^8 || ^9
description: 'globalrs'
libraries:
  - globalrs/globalrs

globalrs.module

globalrs.module

function globalrs_preprocess_page(&$variables) {
  $variables['#attached']['library'][] = 'globalrs/globalrs';
}

globalrs.libraries.yml

globalrs.libraries.yml

globalrs:
  js:
    behavior.js: {}
  css:
    theme:
      style.css: {}

style.css

style.css

* {
    background: red;
}

My problem

My problem is that the website won't load, instead the following error appears.:

The website encountered an unexpected error. Please try again later.

Even if I delete the module directory and flush all caches (theflushing all cache_cache_ tables, as well as the *cachetags`cachetags table, and flushing the browser's cache), the website still has that error. Sinceerror;
Since that error is generic, I don't know how to start to solve the problem.

A bug as a possible reason

It may be that the problem started after I have added $settings['rebuild_access'] = TRUE; to the end of /sites/default/settings.php, saved the file, and then navigated in my web browser to localhost/example.com/core/rebuild.php, where I got the following error.:

Fatal error: Uncaught PDOException: SQLSTATE[HY000] [1044] Access denied for user 'example.com'@'localhost' to database 'example.com' in

I believe thatEdit (removing the problem happened sometime when I tried to restore a backuprest of the website toerror messages because this is caused by an unrelated error while restoring a new emptybackup):

I believe that the problem happened sometime when I tried to restore a backup of the website to a new empty database with the same name which was registered as associated with the database user (or appeared to be such) but actually wasn't

Update - solution

I paste this here after Clive deleted my answer:

I revoked all database with-specific privileges that the same name which was registered as associated withdatabase user had on the database user (or appeareddatabase with the same name and then re-granted these database-specific privileges1 to be such) but actually wasn'tthat user; I could then access the website.

I am using Drupal 9.2.7 on XAMPP 7.3.29, with PHP 7.4.21 on Windows 10 Home.

I tried to create a custom module which allows global JavaScript and CSS (effective in all webpages in my website), by creating the root/modules/globalrs directory with the following files.

globalrs.info.yml

name: globalrs
type: module
core_version_requirement: ^8 || ^9
description: 'globalrs'
libraries:
  - globalrs/globalrs

globalrs.module

function globalrs_preprocess_page(&$variables) {
  $variables['#attached']['library'][] = 'globalrs/globalrs';
}

globalrs.libraries.yml

globalrs:
  js:
    behavior.js: {}
  css:
    theme:
      style.css: {}

style.css

* {
    background: red;
}

My problem is that the website won't load, instead the following error appears.

The website encountered an unexpected error. Please try again later.

Even if I delete the module directory and flush all caches (the cache_ tables, the *cachetags` table, and the browser's cache), the website still has that error. Since that error is generic, I don't know how to start to solve the problem.

It may be that the problem started after I have added $settings['rebuild_access'] = TRUE; to the end of /sites/default/settings.php, saved the file, and then navigated in my web browser to localhost/example.com/core/rebuild.php, where I got the following error.

Fatal error: Uncaught PDOException: SQLSTATE[HY000] [1044] Access denied for user 'example.com'@'localhost' to database 'example.com'

I believe that the problem happened sometime when I tried to restore a backup of the website to a new empty database with the same name which was registered as associated with the database user (or appeared to be such) but actually wasn't.

Drupal 9.2.7 on XAMPP 7.3.29  , 7.4.21 on Windows 10 Home.

I tried to create a custom module which allows global JavaScript and CSS (effective in all webpages in my website), by creating the directory root/modules/globalrs with the following files:

globalrs.info.yml

name: globalrs
type: module
core_version_requirement: ^8 || ^9
description: 'globalrs'
libraries:
  - globalrs/globalrs

globalrs.module

function globalrs_preprocess_page(&$variables) {
  $variables['#attached']['library'][] = 'globalrs/globalrs';
}

globalrs.libraries.yml

globalrs:
  js:
    behavior.js: {}
  css:
    theme:
      style.css: {}

style.css

* {
    background: red;
}

My problem

My problem is that the website won't load, instead the following error appears:

The website encountered an unexpected error. Please try again later.

Even if I delete the module directory and flush all caches (flushing all cache_ tables as well as the cachetags table, and flushing the browser's cache, the website still has that error;
Since that error is generic, I don't know how to start to solve the problem.

A bug as a possible reason

It may be that the problem started after I have added $settings['rebuild_access'] = TRUE; to the end of /sites/default/settings.php, saved the file and then navigated in my web browser to localhost/example.com/core/rebuild.php, where I got the following error:

Fatal error: Uncaught PDOException: SQLSTATE[HY000] [1044] Access denied for user 'example.com'@'localhost' to database 'example.com' in

Edit (removing the rest of the error messages because this is caused by an unrelated error while restoring a backup):

I believe that the problem happened sometime when I tried to restore a backup of the website to a new empty database with the same name which was registered as associated with the database user (or appeared to be such) but actually wasn't

Update - solution

I paste this here after Clive deleted my answer:

I revoked all database-specific privileges that the database user had on the database with the same name and then re-granted these database-specific privileges1 to that user; I could then access the website.

question and answers need to be separated posts.
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

I am using Drupal 9.2.7 on XAMPP 7.3.29  , with PHP 7.4.21 on Windows 10 Home.

I tried to create a custom module which allows global JavaScript and CSS (effective in all webpages in my website), by creating the directory root/modules/globalrsroot/modules/globalrs directory with the following files:.

globalrs.info.yml

globalrs.info.yml

name: globalrs
type: module
core_version_requirement: ^8 || ^9
description: 'globalrs'
libraries:
  - globalrs/globalrs

globalrs.module

globalrs.module

function globalrs_preprocess_page(&$variables) {
  $variables['#attached']['library'][] = 'globalrs/globalrs';
}

globalrs.libraries.yml

globalrs.libraries.yml

globalrs:
  js:
    behavior.js: {}
  css:
    theme:
      style.css: {}

style.css

style.css

* {
    background: red;
}

My problem

My problem is that the website won't load, instead the following error appears:.

The website encountered an unexpected error. Please try again later.

Even if I delete the module directory and flush all caches (flushing allthe cache_cache_ tables as well as, the cachetags*cachetags` table, and flushing the browser's cache), the website still has that error;
Sinceerror. Since that error is generic, I don't know how to start to solve the problem.

A bug as a possible reason

It may be that the problem started after I have added $settings['rebuild_access'] = TRUE; to the end of /sites/default/settings.php, saved the file, and then navigated in my web browser to localhost/example.com/core/rebuild.php, where I got the following error:.

Fatal error: Uncaught PDOException: SQLSTATE[HY000] [1044] Access denied for user 'example.com'@'localhost' to database 'example.com' in

Edit (removingI believe that the restproblem happened sometime when I tried to restore a backup of the error messages because this is caused by an unrelated error while restoringwebsite to a backup):

I believe that the problem happened sometime when I tried to restore a backup of the website to a new empty database with the same name which was registered as associated with the database user (or appeared to be such) but actually wasn't

Update - solution

I paste this here after Clive deleted my answer:

I revoked allnew empty database-specific privileges that with the database user had onsame name which was registered as associated with the database with the same name and then re-granted these database-specific privileges1 user (or appeared to that user; I could then access the websitebe such) but actually wasn't.

Drupal 9.2.7 on XAMPP 7.3.29  , 7.4.21 on Windows 10 Home.

I tried to create a custom module which allows global JavaScript and CSS (effective in all webpages in my website), by creating the directory root/modules/globalrs with the following files:

globalrs.info.yml

name: globalrs
type: module
core_version_requirement: ^8 || ^9
description: 'globalrs'
libraries:
  - globalrs/globalrs

globalrs.module

function globalrs_preprocess_page(&$variables) {
  $variables['#attached']['library'][] = 'globalrs/globalrs';
}

globalrs.libraries.yml

globalrs:
  js:
    behavior.js: {}
  css:
    theme:
      style.css: {}

style.css

* {
    background: red;
}

My problem

My problem is that the website won't load, instead the following error appears:

The website encountered an unexpected error. Please try again later.

Even if I delete the module directory and flush all caches (flushing all cache_ tables as well as the cachetags table, and flushing the browser's cache, the website still has that error;
Since that error is generic, I don't know how to start to solve the problem.

A bug as a possible reason

It may be that the problem started after I have added $settings['rebuild_access'] = TRUE; to the end of /sites/default/settings.php, saved the file and then navigated in my web browser to localhost/example.com/core/rebuild.php, where I got the following error:

Fatal error: Uncaught PDOException: SQLSTATE[HY000] [1044] Access denied for user 'example.com'@'localhost' to database 'example.com' in

Edit (removing the rest of the error messages because this is caused by an unrelated error while restoring a backup):

I believe that the problem happened sometime when I tried to restore a backup of the website to a new empty database with the same name which was registered as associated with the database user (or appeared to be such) but actually wasn't

Update - solution

I paste this here after Clive deleted my answer:

I revoked all database-specific privileges that the database user had on the database with the same name and then re-granted these database-specific privileges1 to that user; I could then access the website.

I am using Drupal 9.2.7 on XAMPP 7.3.29, with PHP 7.4.21 on Windows 10 Home.

I tried to create a custom module which allows global JavaScript and CSS (effective in all webpages in my website), by creating the root/modules/globalrs directory with the following files.

globalrs.info.yml

name: globalrs
type: module
core_version_requirement: ^8 || ^9
description: 'globalrs'
libraries:
  - globalrs/globalrs

globalrs.module

function globalrs_preprocess_page(&$variables) {
  $variables['#attached']['library'][] = 'globalrs/globalrs';
}

globalrs.libraries.yml

globalrs:
  js:
    behavior.js: {}
  css:
    theme:
      style.css: {}

style.css

* {
    background: red;
}

My problem is that the website won't load, instead the following error appears.

The website encountered an unexpected error. Please try again later.

Even if I delete the module directory and flush all caches (the cache_ tables, the *cachetags` table, and the browser's cache), the website still has that error. Since that error is generic, I don't know how to start to solve the problem.

It may be that the problem started after I have added $settings['rebuild_access'] = TRUE; to the end of /sites/default/settings.php, saved the file, and then navigated in my web browser to localhost/example.com/core/rebuild.php, where I got the following error.

Fatal error: Uncaught PDOException: SQLSTATE[HY000] [1044] Access denied for user 'example.com'@'localhost' to database 'example.com'

I believe that the problem happened sometime when I tried to restore a backup of the website to a new empty database with the same name which was registered as associated with the database user (or appeared to be such) but actually wasn't.

added 306 characters in body
Source Link

Drupal 9.2.7 on XAMPP 7.3.29 , 7.4.21 on Windows 10 Home.

I tried to create a custom module which allows global JavaScript and CSS (effective in all webpages in my website), by creating the directory root/modules/globalrs with the following files:

globalrs.info.yml

name: globalrs
type: module
core_version_requirement: ^8 || ^9
description: 'globalrs'
libraries:
  - globalrs/globalrs

globalrs.module

function globalrs_preprocess_page(&$variables) {
  $variables['#attached']['library'][] = 'globalrs/globalrs';
}

globalrs.libraries.yml

globalrs:
  js:
    behavior.js: {}
  css:
    theme:
      style.css: {}

style.css

* {
    background: red;
}

My problem

My problem is that the website won't load, instead the following error appears:

The website encountered an unexpected error. Please try again later.

Even if I delete the module directory and flush all caches (flushing all cache_ tables as well as the cachetags table, and flushing the browser's cache, the website still has that error;
Since that error is generic, I don't know how to start to solve the problem.

A bug as a possible reason

It may be that the problem started after I have added $settings['rebuild_access'] = TRUE; to the end of /sites/default/settings.php, saved the file and then navigated in my web browser to localhost/example.com/core/rebuild.php, where I got the following error:

Fatal error: Uncaught PDOException: SQLSTATE[HY000] [1044] Access denied for user 'example.com'@'localhost' to database 'example.com' in

Edit (removing the rest of the error messages because this is caused by an unrelated error while restoring a backup):

I believe that the problem happened sometime when I tried to restore a backup of the website to a new empty database with the same name which was registered as associated with the database user (or appeared to be such) but actually wasn't

Update - solution

I paste this here after Clive deleted my answer:

I revoked all database-specific privileges that the database user had on the database with the same name and then re-granted these database-specific privileges1 to that user; I could then access the website.

Drupal 9.2.7 on XAMPP 7.3.29 , 7.4.21 on Windows 10 Home.

I tried to create a custom module which allows global JavaScript and CSS (effective in all webpages in my website), by creating the directory root/modules/globalrs with the following files:

globalrs.info.yml

name: globalrs
type: module
core_version_requirement: ^8 || ^9
description: 'globalrs'
libraries:
  - globalrs/globalrs

globalrs.module

function globalrs_preprocess_page(&$variables) {
  $variables['#attached']['library'][] = 'globalrs/globalrs';
}

globalrs.libraries.yml

globalrs:
  js:
    behavior.js: {}
  css:
    theme:
      style.css: {}

style.css

* {
    background: red;
}

My problem

My problem is that the website won't load, instead the following error appears:

The website encountered an unexpected error. Please try again later.

Even if I delete the module directory and flush all caches (flushing all cache_ tables as well as the cachetags table, and flushing the browser's cache, the website still has that error;
Since that error is generic, I don't know how to start to solve the problem.

A bug as a possible reason

It may be that the problem started after I have added $settings['rebuild_access'] = TRUE; to the end of /sites/default/settings.php, saved the file and then navigated in my web browser to localhost/example.com/core/rebuild.php, where I got the following error:

Fatal error: Uncaught PDOException: SQLSTATE[HY000] [1044] Access denied for user 'example.com'@'localhost' to database 'example.com' in

Edit (removing the rest of the error messages because this is caused by an unrelated error while restoring a backup):

I believe that the problem happened sometime when I tried to restore a backup of the website to a new empty database with the same name which was registered as associated with the database user (or appeared to be such) but actually wasn't

Drupal 9.2.7 on XAMPP 7.3.29 , 7.4.21 on Windows 10 Home.

I tried to create a custom module which allows global JavaScript and CSS (effective in all webpages in my website), by creating the directory root/modules/globalrs with the following files:

globalrs.info.yml

name: globalrs
type: module
core_version_requirement: ^8 || ^9
description: 'globalrs'
libraries:
  - globalrs/globalrs

globalrs.module

function globalrs_preprocess_page(&$variables) {
  $variables['#attached']['library'][] = 'globalrs/globalrs';
}

globalrs.libraries.yml

globalrs:
  js:
    behavior.js: {}
  css:
    theme:
      style.css: {}

style.css

* {
    background: red;
}

My problem

My problem is that the website won't load, instead the following error appears:

The website encountered an unexpected error. Please try again later.

Even if I delete the module directory and flush all caches (flushing all cache_ tables as well as the cachetags table, and flushing the browser's cache, the website still has that error;
Since that error is generic, I don't know how to start to solve the problem.

A bug as a possible reason

It may be that the problem started after I have added $settings['rebuild_access'] = TRUE; to the end of /sites/default/settings.php, saved the file and then navigated in my web browser to localhost/example.com/core/rebuild.php, where I got the following error:

Fatal error: Uncaught PDOException: SQLSTATE[HY000] [1044] Access denied for user 'example.com'@'localhost' to database 'example.com' in

Edit (removing the rest of the error messages because this is caused by an unrelated error while restoring a backup):

I believe that the problem happened sometime when I tried to restore a backup of the website to a new empty database with the same name which was registered as associated with the database user (or appeared to be such) but actually wasn't

Update - solution

I paste this here after Clive deleted my answer:

I revoked all database-specific privileges that the database user had on the database with the same name and then re-granted these database-specific privileges1 to that user; I could then access the website.

removing the rest of the error messages because this is caused by an unrelated error while restoring a backup
Source Link
4uk4
  • 101.7k
  • 7
  • 173
  • 217
Loading
added 2755 characters in body
Source Link
Loading
added 13 characters in body
Source Link
Loading
added 277 characters in body
Source Link
Loading
added 14 characters in body
Source Link
Loading
added 35 characters in body
Source Link
Loading
Source Link
Loading