Unable to restore from backup on AWS container #3768

Closed
opened 2026-02-05 07:23:10 +03:00 by OVERLORD · 19 comments
Owner

Originally created by @Shisupun on GitHub (Apr 29, 2023).

Describe the Bug

I've had a bookstack application running on a container for about a year. I've needed to switch it to a different container. I've backed up the sql and all the files as outlined in here.

I've installed a fresh instance on AWS with the same conditions & issues outlined here and solved them as per the issue as well.

At this point, it is possible to log in and use Bookstack as a brand new one without data, and the DNS is pointing to it correctly and has had the time to propagate.

Now i want to restore from the backup.
When I follow the procedure from Restoring Bookstack, by commenting out php artisan migrate and unzipping the backed up files and database, the entire page stops working and I get the http error 500.

Unable to find a solution, I deleted everything and created a fresh instance again with a working version of Bookstack, but this time I left php artisan migrate uncommented.

When I now copy the database and files with their respective commands:
sudo mysql -u root bookstack < bookstack.backup.sql
and
sudo tar -xvzf bookstack-files-backup.tar.gz

The same error comes on the page that the connection is timing out and the instance stops working and the previous data seems lost. What can I do to fix this?

Steps to Reproduce

  1. Create a backup of the database and files as outlined here.

  2. Create a fresh AWS EC2 container as outlined here

  3. Follow the restoring instructions from step 1 and encounter that the restore leads to the http 500 error page.
    -By going to /var/www/bookstack/ and running "sudo mysql -u root bookstack < bookstack.backup.sql"
    As well as within the /var/www/bookstack/ running "sudo tar -xvzf bookstack-files-backup.tar.gz"

  4. Repeat step 1 and 2, but this time leaving php artisan migrate uncommented

  5. Repeat the restoring steps of part 1 and realize that step 5 leads to an identical result of step 3, which is that the bookstack page is not loading anymore with the http 500 error.

Expected Behaviour

Restoring backed up database and files replaces the themes, colors, user registrations, books etc. from the previous backup.

Screenshots or Additional Context

Composer version 2.5.5

Browser Details

No response

Exact BookStack Version

v23.02.3, version from backup is unknown

PHP Version

8.2.5

Hosting Environment

Ubuntu 20.04, AWS t2 micro, 30GB space.

Originally created by @Shisupun on GitHub (Apr 29, 2023). ### Describe the Bug I've had a bookstack application running on a container for about a year. I've needed to switch it to a different container. I've backed up the sql and all the files as outlined in [here](https://www.bookstackapp.com/docs/admin/backup-restore/). I've installed a fresh instance on AWS with the same conditions & issues outlined [here](https://github.com/BookStackApp/BookStack/issues/4198) and solved them as per the issue as well. At this point, it is possible to log in and use Bookstack as a brand new one without data, and the DNS is pointing to it correctly and has had the time to propagate. Now i want to restore from the backup. When I follow the procedure from [Restoring](https://www.bookstackapp.com/docs/admin/backup-restore/) Bookstack, by commenting out php artisan migrate and unzipping the backed up files and database, the entire page stops working and I get the http error 500. Unable to find a solution, I deleted everything and created a fresh instance again with a working version of Bookstack, but this time I left php artisan migrate uncommented. When I now copy the database and files with their respective commands: sudo mysql -u root bookstack < bookstack.backup.sql and sudo tar -xvzf bookstack-files-backup.tar.gz The same error comes on the page that the connection is timing out and the instance stops working and the previous data seems lost. What can I do to fix this? ### Steps to Reproduce 1. Create a backup of the database and files as outlined [here](https://www.bookstackapp.com/docs/admin/backup-restore/). 2. Create a fresh AWS EC2 container as outlined [here](https://github.com/BookStackApp/BookStack/issues/4198) 3. Follow the restoring instructions from step 1 and encounter that the restore leads to the http 500 error page. -By going to /var/www/bookstack/ and running "sudo mysql -u root bookstack < bookstack.backup.sql" As well as within the /var/www/bookstack/ running "sudo tar -xvzf bookstack-files-backup.tar.gz" 5. Repeat step 1 and 2, but this time leaving php artisan migrate uncommented 6. Repeat the restoring steps of part 1 and realize that step 5 leads to an identical result of step 3, which is that the bookstack page is not loading anymore with the http 500 error. ### Expected Behaviour Restoring backed up database and files replaces the themes, colors, user registrations, books etc. from the previous backup. ### Screenshots or Additional Context Composer version 2.5.5 ### Browser Details _No response_ ### Exact BookStack Version v23.02.3, version from backup is unknown ### PHP Version 8.2.5 ### Hosting Environment Ubuntu 20.04, AWS t2 micro, 30GB space.
OVERLORD added the 🐕 Support label 2026-02-05 07:23:10 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Apr 29, 2023):

Hi @Shisupun,
Can you watch/check the /var/log/apache2/error.log file and report back lines that appear when you access the site to show a 500 error.

@ssddanbrown commented on GitHub (Apr 29, 2023): Hi @Shisupun, Can you watch/check the `/var/log/apache2/error.log` file and report back lines that appear when you access the site to show a 500 error.
Author
Owner

@Shisupun commented on GitHub (Apr 29, 2023):

Hi @Shisupun, Can you watch/check the /var/log/apache2/error.log file and report back lines that appear when you access the site to show a 500 error.

Sure thing, here's the output:

Details

Sat Apr 29 11:33:52.246124 2023] [php:error] [pid 25662] [client 212.120.83.177:58627] PHP Fatal error:  Uncaught PDOException: SQLSTATE[HY000] [1045] Access denied for user 'bookstack'@'localhost' (using password: YES) in /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70\nStack trace:\n#0 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(70): PDO->__construct()\n#1 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(45): Illuminate\\Database\\Connectors\\Connector->createPdoConnection()\n#2 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connectors/MySqlConnector.php(24): Illuminate\\Database\\Connectors\\Connector->createConnection()\n#3 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php(184): Illuminate\\Database\\Connectors\\MySqlConnector->connect()\n#4 [internal function]: Illuminate\\Database\\Connectors\\ConnectionFactory->Illuminate\\Database\\Connectors\\{closure}()\n#5 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php(1181): call_user_func()\n#6 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php(1217): Illuminate\\Database\\Connection->getPdo()\n#7 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php(486): Illuminate\\Database\\Connection->getReadPdo()\n#8 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php(414): Illuminate\\Database\\Connection->getPdoForSelect()\n#9 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php(753): Illuminate\\Database\\Connection->Illuminate\\Database\\{closure}()\n#10 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php(720): Illuminate\\Database\\Connection->runQueryCallback()\n#11 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php(405): Illuminate\\Database\\Connection->run()\n#12 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2705): Illuminate\\Database\\Connection->select()\n#13 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2694): Illuminate\\Database\\Query\\Builder->runSelect()\n#14 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3230): Illuminate\\Database\\Query\\Builder->Illuminate\\Database\\Query\\{closure}()\n#15 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2693): Illuminate\\Database\\Query\\Builder->onceWithColumns()\n#16 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(710): Illuminate\\Database\\Query\\Builder->get()\n#17 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(694): Illuminate\\Database\\Eloquent\\Builder->getModels()\n#18 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Concerns/BuildsQueries.php(296): Illuminate\\Database\\Eloquent\\Builder->get()\n#19 /var/www/bookstack/app/Auth/User.php(104): Illuminate\\Database\\Eloquent\\Builder->first()\n#20 /var/www/bookstack/app/helpers.php(38): BookStack\\Auth\\User::getDefault()\n#21 /var/www/bookstack/app/Settings/SettingService.php(62): user()\n#22 /var/www/bookstack/storage/framework/views/58966642253d57ffe4f154d44ae65835f6011243.php(4): BookStack\\Settings\\SettingService->getForCurrentUser()\n#23 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(109): require('...')\n#24 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(110): Illuminate\\Filesystem\\Filesystem::Illuminate\\Filesystem\\{closure}()\n#25 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(58): Illuminate\\Filesystem\\Filesystem->getRequire()\n#26 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(70): Illuminate\\View\\Engines\\PhpEngine->evaluatePath()\n#27 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/View.php(195): Illuminate\\View\\Engines\\CompilerEngine->get()\n#28 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/View.php(178): Illuminate\\View\\View->getContents()\n#29 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/View.php(147): Illuminate\\View\\View->renderContents()\n#30 /var/www/bookstack/storage/framework/views/444e2e0a8c776f8bed9002e3000a037539df392e.php(16): Illuminate\\View\\View->render()\n#31 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(109): require('...')\n#32 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(110): Illuminate\\Filesystem\\Filesystem::Illuminate\\Filesystem\\{closure}()\n#33 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(58): Illuminate\\Filesystem\\Filesystem->getRequire()\n#34 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(70): Illuminate\\View\\Engines\\PhpEngine->evaluatePath()\n#35 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/View.php(195): Illuminate\\View\\Engines\\CompilerEngine->get()\n#36 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/View.php(178): Illuminate\\View\\View->getContents()\n#37 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/View.php(147): Illuminate\\View\\View->renderContents()\n#38 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Http/Response.php(69): Illuminate\\View\\View->render()\n#39 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Http/Response.php(35): Illuminate\\Http\\Response->setContent()\n#40 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Routing/ResponseFactory.php(57): Illuminate\\Http\\Response->__construct()\n#41 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Routing/ResponseFactory.php(87): Illuminate\\Routing\\ResponseFactory->make()\n#42 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(626): Illuminate\\Routing\\ResponseFactory->view()\n#43 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(554): Illuminate\\Foundation\\Exceptions\\Handler->renderHttpException()\n#44 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(460): Illuminate\\Foundation\\Exceptions\\Handler->prepareResponse()\n#45 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(377): Illuminate\\Foundation\\Exceptions\\Handler->renderExceptionResponse()\n#46 /var/www/bookstack/app/Exceptions/Handler.php(66): Illuminate\\Foundation\\Exceptions\\Handler->render()\n#47 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(229): BookStack\\Exceptions\\Handler->render()\n#48 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(206): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->renderHttpResponse()\n#49 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(242): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleException()\n#50 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(266): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleShutdown()\n#51 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->Illuminate\\Foundation\\Bootstrap\\{closure}()\n#52 {main}\n\nNext Illuminate\\Database\\QueryException: SQLSTATE[HY000] [1045] Access denied for user 'bookstack'@'localhost' (using password: YES) (SQL: select * from `users` where `system_name` = public limit 1) in /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php:760\nStack trace:\n#0 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php(720): Illuminate\\Database\\Connection->runQueryCallback()\n#1 /var/ww

@Shisupun commented on GitHub (Apr 29, 2023): > Hi @Shisupun, Can you watch/check the `/var/log/apache2/error.log` file and report back lines that appear when you access the site to show a 500 error. Sure thing, here's the output: <details><summary>Details</summary> <p> ``` Sat Apr 29 11:33:52.246124 2023] [php:error] [pid 25662] [client 212.120.83.177:58627] PHP Fatal error: Uncaught PDOException: SQLSTATE[HY000] [1045] Access denied for user 'bookstack'@'localhost' (using password: YES) in /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70\nStack trace:\n#0 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(70): PDO->__construct()\n#1 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(45): Illuminate\\Database\\Connectors\\Connector->createPdoConnection()\n#2 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connectors/MySqlConnector.php(24): Illuminate\\Database\\Connectors\\Connector->createConnection()\n#3 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php(184): Illuminate\\Database\\Connectors\\MySqlConnector->connect()\n#4 [internal function]: Illuminate\\Database\\Connectors\\ConnectionFactory->Illuminate\\Database\\Connectors\\{closure}()\n#5 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php(1181): call_user_func()\n#6 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php(1217): Illuminate\\Database\\Connection->getPdo()\n#7 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php(486): Illuminate\\Database\\Connection->getReadPdo()\n#8 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php(414): Illuminate\\Database\\Connection->getPdoForSelect()\n#9 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php(753): Illuminate\\Database\\Connection->Illuminate\\Database\\{closure}()\n#10 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php(720): Illuminate\\Database\\Connection->runQueryCallback()\n#11 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php(405): Illuminate\\Database\\Connection->run()\n#12 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2705): Illuminate\\Database\\Connection->select()\n#13 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2694): Illuminate\\Database\\Query\\Builder->runSelect()\n#14 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3230): Illuminate\\Database\\Query\\Builder->Illuminate\\Database\\Query\\{closure}()\n#15 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2693): Illuminate\\Database\\Query\\Builder->onceWithColumns()\n#16 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(710): Illuminate\\Database\\Query\\Builder->get()\n#17 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(694): Illuminate\\Database\\Eloquent\\Builder->getModels()\n#18 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Concerns/BuildsQueries.php(296): Illuminate\\Database\\Eloquent\\Builder->get()\n#19 /var/www/bookstack/app/Auth/User.php(104): Illuminate\\Database\\Eloquent\\Builder->first()\n#20 /var/www/bookstack/app/helpers.php(38): BookStack\\Auth\\User::getDefault()\n#21 /var/www/bookstack/app/Settings/SettingService.php(62): user()\n#22 /var/www/bookstack/storage/framework/views/58966642253d57ffe4f154d44ae65835f6011243.php(4): BookStack\\Settings\\SettingService->getForCurrentUser()\n#23 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(109): require('...')\n#24 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(110): Illuminate\\Filesystem\\Filesystem::Illuminate\\Filesystem\\{closure}()\n#25 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(58): Illuminate\\Filesystem\\Filesystem->getRequire()\n#26 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(70): Illuminate\\View\\Engines\\PhpEngine->evaluatePath()\n#27 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/View.php(195): Illuminate\\View\\Engines\\CompilerEngine->get()\n#28 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/View.php(178): Illuminate\\View\\View->getContents()\n#29 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/View.php(147): Illuminate\\View\\View->renderContents()\n#30 /var/www/bookstack/storage/framework/views/444e2e0a8c776f8bed9002e3000a037539df392e.php(16): Illuminate\\View\\View->render()\n#31 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(109): require('...')\n#32 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(110): Illuminate\\Filesystem\\Filesystem::Illuminate\\Filesystem\\{closure}()\n#33 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(58): Illuminate\\Filesystem\\Filesystem->getRequire()\n#34 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(70): Illuminate\\View\\Engines\\PhpEngine->evaluatePath()\n#35 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/View.php(195): Illuminate\\View\\Engines\\CompilerEngine->get()\n#36 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/View.php(178): Illuminate\\View\\View->getContents()\n#37 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/View.php(147): Illuminate\\View\\View->renderContents()\n#38 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Http/Response.php(69): Illuminate\\View\\View->render()\n#39 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Http/Response.php(35): Illuminate\\Http\\Response->setContent()\n#40 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Routing/ResponseFactory.php(57): Illuminate\\Http\\Response->__construct()\n#41 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Routing/ResponseFactory.php(87): Illuminate\\Routing\\ResponseFactory->make()\n#42 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(626): Illuminate\\Routing\\ResponseFactory->view()\n#43 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(554): Illuminate\\Foundation\\Exceptions\\Handler->renderHttpException()\n#44 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(460): Illuminate\\Foundation\\Exceptions\\Handler->prepareResponse()\n#45 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(377): Illuminate\\Foundation\\Exceptions\\Handler->renderExceptionResponse()\n#46 /var/www/bookstack/app/Exceptions/Handler.php(66): Illuminate\\Foundation\\Exceptions\\Handler->render()\n#47 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(229): BookStack\\Exceptions\\Handler->render()\n#48 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(206): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->renderHttpResponse()\n#49 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(242): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleException()\n#50 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(266): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleShutdown()\n#51 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->Illuminate\\Foundation\\Bootstrap\\{closure}()\n#52 {main}\n\nNext Illuminate\\Database\\QueryException: SQLSTATE[HY000] [1045] Access denied for user 'bookstack'@'localhost' (using password: YES) (SQL: select * from `users` where `system_name` = public limit 1) in /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php:760\nStack trace:\n#0 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php(720): Illuminate\\Database\\Connection->runQueryCallback()\n#1 /var/ww ``` </p> </details>
Author
Owner

@ssddanbrown commented on GitHub (Apr 29, 2023):

Hi @Shisupun,
That error indicates the database details within the /var/bookstack/.env are likely wrong.
The install script sets up a local database with a random password for the bookstack database user.
If restoring an old setup into a fresh instance like described, you'd likely want to use the database details from the new instance .env (saving/moving them before restoring the files) or alternatively you could access the database and update the password for used database user to match that used in the now current .env file.

@ssddanbrown commented on GitHub (Apr 29, 2023): Hi @Shisupun, That error indicates the database details within the `/var/bookstack/.env` are likely wrong. The install script sets up a local database with a random password for the bookstack database user. If restoring an old setup into a fresh instance like described, you'd likely want to use the database details from the new instance `.env` (saving/moving them before restoring the files) or alternatively you could access the database and update the password for used database user to match that used in the now current `.env` file.
Author
Owner

@Shisupun commented on GitHub (Apr 29, 2023):

Hi @ssddanbrown,

That would make sense.
I've made a backup of the files before overwriting earlier. When comparing the restored .env and the new .env file, I've changed the APP_KEY and DB_PASSWORD to match that of the fresh .env file.

However I still get an error on the site and there is a similar error on the apache error log. What database details should I be changing? Should it be from the .env file or somewhere else?

Also, how do I access the database and update the password used to match?

@Shisupun commented on GitHub (Apr 29, 2023): Hi @ssddanbrown, That would make sense. I've made a backup of the files before overwriting earlier. When comparing the restored .env and the new .env file, I've changed the APP_KEY and DB_PASSWORD to match that of the fresh .env file. However I still get an error on the site and there is a similar error on the apache error log. What database details should I be changing? Should it be from the .env file or somewhere else? Also, how do I access the database and update the password used to match?
Author
Owner

@ssddanbrown commented on GitHub (Apr 29, 2023):

@Shisupun Use the APP_KEY of the old file.

What database details should I be changing? Should it be from the .env file or somewhere else?

Assuming you used a script before for the old install, just the password unless you changed things before.

You can test database connection by attempting to migrate the database via php artisan migrate from your BookStack install directory. What do you see when running that?

Also, how do I access the database and update the password used to match?

You'd access the database via mysql and run user commands, but leave that as a last resort. Between the two env files you should have the required details.

@ssddanbrown commented on GitHub (Apr 29, 2023): @Shisupun Use the `APP_KEY` of the old file. > What database details should I be changing? Should it be from the .env file or somewhere else? Assuming you used a script before for the old install, just the password unless you changed things before. You can test database connection by attempting to migrate the database via `php artisan migrate` from your BookStack install directory. What do you see when running that? > Also, how do I access the database and update the password used to match? You'd access the database via `mysql` and run user commands, but leave that as a last resort. Between the two env files you should have the required details.
Author
Owner

@Shisupun commented on GitHub (Apr 29, 2023):

image
php artisan migrate worked fine, however the application still does not work where the site can't be reached as its refused to connect. Likewise the apache logs also still say that the access is denied for the user bookstack@localhost. However the old(restored) and new (fresh) .env files have bookstack as the user, and the DB password has been copied over from the fresh env to the restored env file.

Maybe its time to use the last resort?

@Shisupun commented on GitHub (Apr 29, 2023): ![image](https://user-images.githubusercontent.com/33734048/235304652-5a64f8d0-2997-4d80-8386-102416927c7e.png) php artisan migrate worked fine, however the application still does not work where the site can't be reached as its refused to connect. Likewise the apache logs also still say that the access is denied for the user bookstack@localhost. However the old(restored) and new (fresh) .env files have bookstack as the user, and the DB password has been copied over from the fresh env to the restored env file. Maybe its time to use the last resort?
Author
Owner

@ssddanbrown commented on GitHub (Apr 29, 2023):

Maybe its time to use the last resort?

But there's something else going on if php artisan migrate works fine. That shows the details in the .env are now correct.

Likewise the apache logs also still say that the access is denied

Are you looking at the latest lines relevant for your error scenario?
I'd usually watch the logs via sudo tail -f /var/log/apache2/error.log. Then access the site and you should see new lines appear. Use Ctrl+C to stop watching. Otherwise, be sure to read the end of the file and make sure the timestamps match up.

@ssddanbrown commented on GitHub (Apr 29, 2023): > Maybe its time to use the last resort? But there's something else going on if `php artisan migrate` works fine. That shows the details in the `.env` are now correct. > Likewise the apache logs also still say that the access is denied Are you looking at the latest lines relevant for your error scenario? I'd usually watch the logs via `sudo tail -f /var/log/apache2/error.log`. Then access the site and you should see new lines appear. Use `Ctrl+C` to stop watching. Otherwise, be sure to read the end of the file and make sure the timestamps match up.
Author
Owner

@Shisupun commented on GitHub (Apr 29, 2023):

Are you looking at the latest lines relevant for your error scenario?

Yes I can only assume so by looking at the last lines of the file, which always have been saying the same thing. Also, earlier today the final line with the error was changing every so often to update the timestamp, now the timestamp isnt changing. So I am assuming that the apache2 error log file isnt updating when i try to access the site any more.

However the previous error with the access denied still seems to be the case.

Error;

[Sat Apr 29 12:27:14.966877 2023] [php:error] [pid 35825] [client 135.125.217.54:58366] PHP Fatal error:  Uncaught PDOException: SQLSTATE[HY000] [1045] Access denied for user 'bookstack'@'localhost' (using password: YES) in /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70\nStack trace:\n#0 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(70): PDO->__construct()\n#1 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(45): Illuminate\\Database\\Connectors\\Connector->createPdoConnection()\n#2 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connectors/MySqlConnector.php(24): Illuminate\\Database\\Connectors\\Connector->createConnection()\n#3 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php(184): Illuminate\\Database\\Connectors\\MySqlConnector->connect()\n#4 [internal function]: Illuminate\\Database\\Connectors\\ConnectionFactory->Illuminate\\Database\\Connectors\\{closure}()\n#5 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php(1181): call_user_func()\n#6 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php(1217): Illuminate\\Database\\Connection->getPdo()\n#7 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php(486): Illuminate\\Database\\Connection->getReadPdo()\n#8 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php(414): Illuminate\\Database\\Connection->getPdoForSelect()\n#9 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php(753): Illuminate\\Database\\Connection->Illuminate\\Database\\{closure}()\n#10 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php(720): Illuminate\\Database\\Connection->runQueryCallback()\n#11 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php(405): Illuminate\\Database\\Connection->run()\n#12 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2705): Illuminate\\Database\\Connection->select()\n#13 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2694): Illuminate\\Database\\Query\\Builder->runSelect()\n#14 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3230): Illuminate\\Database\\Query\\Builder->Illuminate\\Database\\Query\\{closure}()\n#15 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2693): Illuminate\\Database\\Query\\Builder->onceWithColumns()\n#16 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(710): Illuminate\\Database\\Query\\Builder->get()\n#17 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(694): Illuminate\\Database\\Eloquent\\Builder->getModels()\n#18 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Concerns/BuildsQueries.php(296): Illuminate\\Database\\Eloquent\\Builder->get()\n#19 /var/www/bookstack/app/Auth/User.php(104): Illuminate\\Database\\Eloquent\\Builder->first()\n#20 /var/www/bookstack/app/helpers.php(38): BookStack\\Auth\\User::getDefault()\n#21 /var/www/bookstack/app/Settings/SettingService.php(62): user()\n#22 /var/www/bookstack/storage/framework/views/58966642253d57ffe4f154d44ae65835f6011243.php(4): BookStack\\Settings\\SettingService->getForCurrentUser()\n#23 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(109): require('...')\n#24 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(110): Illuminate\\Filesystem\\Filesystem::Illuminate\\Filesystem\\{closure}()\n#25 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(58): Illuminate\\Filesystem\\Filesystem->getRequire()\n#26 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(70): Illuminate\\View\\Engines\\PhpEngine->evaluatePath()\n#27 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/View.php(195): Illuminate\\View\\Engines\\CompilerEngine->get()\n#28 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/View.php(178): Illuminate\\View\\View->getContents()\n#29 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/View.php(147): Illuminate\\View\\View->renderContents()\n#30 /var/www/bookstack/storage/framework/views/444e2e0a8c776f8bed9002e3000a037539df392e.php(16): Illuminate\\View\\View->render()\n#31 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(109): require('...')\n#32 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(110): Illuminate\\Filesystem\\Filesystem::Illuminate\\Filesystem\\{closure}()\n#33 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(58): Illuminate\\Filesystem\\Filesystem->getRequire()\n#34 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(70): Illuminate\\View\\Engines\\PhpEngine->evaluatePath()\n#35 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/View.php(195): Illuminate\\View\\Engines\\CompilerEngine->get()\n#36 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/View.php(178): Illuminate\\View\\View->getContents()\n#37 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/View.php(147): Illuminate\\View\\View->renderContents()\n#38 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Http/Response.php(69): Illuminate\\View\\View->render()\n#39 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Http/Response.php(35): Illuminate\\Http\\Response->setContent()\n#40 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Routing/ResponseFactory.php(57): Illuminate\\Http\\Response->__construct()\n#41 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Routing/ResponseFactory.php(87): Illuminate\\Routing\\ResponseFactory->make()\n#42 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(626): Illuminate\\Routing\\ResponseFactory->view()\n#43 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(554): Illuminate\\Foundation\\Exceptions\\Handler->renderHttpException()\n#44 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(460): Illuminate\\Foundation\\Exceptions\\Handler->prepareResponse()\n#45 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(377): Illuminate\\Foundation\\Exceptions\\Handler->renderExceptionResponse()\n#46 /var/www/bookstack/app/Exceptions/Handler.php(66): Illuminate\\Foundation\\Exceptions\\Handler->render()\n#47 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(229): BookStack\\Exceptions\\Handler->render()\n#48 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(206): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->renderHttpResponse()\n#49 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(242): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleException()\n#50 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(266): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleShutdown()\n#51 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->Illuminate\\Foundation\\Bootstrap\\{closure}()\n#52 {main}\n\nNext Illuminate\\Database\\QueryException: SQLSTATE[HY000] [1045] Access denied for user 'bookstack'@'localhost' (using password: YES) (SQL: select * from `users` where `system_name` = public limit 1) in /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php:760\nStack trace:\n#0 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php(720): Illuminate\\Database\\Connection->runQueryCallback()\n#1 /var/ww
@Shisupun commented on GitHub (Apr 29, 2023): > Are you looking at the latest lines relevant for your error scenario? Yes I can only assume so by looking at the last lines of the file, which always have been saying the same thing. Also, earlier today the final line with the error was changing every so often to update the timestamp, now the timestamp isnt changing. So I am assuming that the apache2 error log file isnt updating when i try to access the site any more. However the previous error with the access denied still seems to be the case. Error; ``` [Sat Apr 29 12:27:14.966877 2023] [php:error] [pid 35825] [client 135.125.217.54:58366] PHP Fatal error: Uncaught PDOException: SQLSTATE[HY000] [1045] Access denied for user 'bookstack'@'localhost' (using password: YES) in /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70\nStack trace:\n#0 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(70): PDO->__construct()\n#1 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(45): Illuminate\\Database\\Connectors\\Connector->createPdoConnection()\n#2 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connectors/MySqlConnector.php(24): Illuminate\\Database\\Connectors\\Connector->createConnection()\n#3 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php(184): Illuminate\\Database\\Connectors\\MySqlConnector->connect()\n#4 [internal function]: Illuminate\\Database\\Connectors\\ConnectionFactory->Illuminate\\Database\\Connectors\\{closure}()\n#5 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php(1181): call_user_func()\n#6 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php(1217): Illuminate\\Database\\Connection->getPdo()\n#7 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php(486): Illuminate\\Database\\Connection->getReadPdo()\n#8 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php(414): Illuminate\\Database\\Connection->getPdoForSelect()\n#9 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php(753): Illuminate\\Database\\Connection->Illuminate\\Database\\{closure}()\n#10 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php(720): Illuminate\\Database\\Connection->runQueryCallback()\n#11 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php(405): Illuminate\\Database\\Connection->run()\n#12 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2705): Illuminate\\Database\\Connection->select()\n#13 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2694): Illuminate\\Database\\Query\\Builder->runSelect()\n#14 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3230): Illuminate\\Database\\Query\\Builder->Illuminate\\Database\\Query\\{closure}()\n#15 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2693): Illuminate\\Database\\Query\\Builder->onceWithColumns()\n#16 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(710): Illuminate\\Database\\Query\\Builder->get()\n#17 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(694): Illuminate\\Database\\Eloquent\\Builder->getModels()\n#18 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Concerns/BuildsQueries.php(296): Illuminate\\Database\\Eloquent\\Builder->get()\n#19 /var/www/bookstack/app/Auth/User.php(104): Illuminate\\Database\\Eloquent\\Builder->first()\n#20 /var/www/bookstack/app/helpers.php(38): BookStack\\Auth\\User::getDefault()\n#21 /var/www/bookstack/app/Settings/SettingService.php(62): user()\n#22 /var/www/bookstack/storage/framework/views/58966642253d57ffe4f154d44ae65835f6011243.php(4): BookStack\\Settings\\SettingService->getForCurrentUser()\n#23 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(109): require('...')\n#24 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(110): Illuminate\\Filesystem\\Filesystem::Illuminate\\Filesystem\\{closure}()\n#25 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(58): Illuminate\\Filesystem\\Filesystem->getRequire()\n#26 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(70): Illuminate\\View\\Engines\\PhpEngine->evaluatePath()\n#27 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/View.php(195): Illuminate\\View\\Engines\\CompilerEngine->get()\n#28 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/View.php(178): Illuminate\\View\\View->getContents()\n#29 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/View.php(147): Illuminate\\View\\View->renderContents()\n#30 /var/www/bookstack/storage/framework/views/444e2e0a8c776f8bed9002e3000a037539df392e.php(16): Illuminate\\View\\View->render()\n#31 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(109): require('...')\n#32 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(110): Illuminate\\Filesystem\\Filesystem::Illuminate\\Filesystem\\{closure}()\n#33 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(58): Illuminate\\Filesystem\\Filesystem->getRequire()\n#34 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(70): Illuminate\\View\\Engines\\PhpEngine->evaluatePath()\n#35 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/View.php(195): Illuminate\\View\\Engines\\CompilerEngine->get()\n#36 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/View.php(178): Illuminate\\View\\View->getContents()\n#37 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/View.php(147): Illuminate\\View\\View->renderContents()\n#38 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Http/Response.php(69): Illuminate\\View\\View->render()\n#39 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Http/Response.php(35): Illuminate\\Http\\Response->setContent()\n#40 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Routing/ResponseFactory.php(57): Illuminate\\Http\\Response->__construct()\n#41 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Routing/ResponseFactory.php(87): Illuminate\\Routing\\ResponseFactory->make()\n#42 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(626): Illuminate\\Routing\\ResponseFactory->view()\n#43 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(554): Illuminate\\Foundation\\Exceptions\\Handler->renderHttpException()\n#44 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(460): Illuminate\\Foundation\\Exceptions\\Handler->prepareResponse()\n#45 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(377): Illuminate\\Foundation\\Exceptions\\Handler->renderExceptionResponse()\n#46 /var/www/bookstack/app/Exceptions/Handler.php(66): Illuminate\\Foundation\\Exceptions\\Handler->render()\n#47 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(229): BookStack\\Exceptions\\Handler->render()\n#48 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(206): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->renderHttpResponse()\n#49 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(242): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleException()\n#50 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(266): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleShutdown()\n#51 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->Illuminate\\Foundation\\Bootstrap\\{closure}()\n#52 {main}\n\nNext Illuminate\\Database\\QueryException: SQLSTATE[HY000] [1045] Access denied for user 'bookstack'@'localhost' (using password: YES) (SQL: select * from `users` where `system_name` = public limit 1) in /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php:760\nStack trace:\n#0 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Database/Connection.php(720): Illuminate\\Database\\Connection->runQueryCallback()\n#1 /var/ww ```
Author
Owner

@ssddanbrown commented on GitHub (Apr 29, 2023):

I'm not convinced it's the same issue, especially if the log timestamp is no longer changing.

Can you watch the apache access log sudo tail -f /var/log/apache2/access.log and confirm if you see new lines added when you attempt to browser your instance?

@ssddanbrown commented on GitHub (Apr 29, 2023): I'm not convinced it's the same issue, especially if the log timestamp is no longer changing. Can you watch the apache access log `sudo tail -f /var/log/apache2/access.log` and confirm if you see new lines added when you attempt to browser your instance?
Author
Owner

@Shisupun commented on GitHub (Apr 29, 2023):

When running sudo tail -f /var/log/apache2/access.log it indeed does update when connecting to the instance.
But my browser will still tell me that the site can not be reached. I double checked that the dns matches, that everything is indeed installed, everything should be working, but its not.
Maybe there's a way I can send you the backups privately and you can see what could be causing the issue?

@Shisupun commented on GitHub (Apr 29, 2023): When running sudo tail -f /var/log/apache2/access.log it indeed does update when connecting to the instance. But my browser will still tell me that the site can not be reached. I double checked that the dns matches, that everything is indeed installed, everything *should* be working, but its not. Maybe there's a way I can send you the backups privately and you can see what could be causing the issue?
Author
Owner

@ssddanbrown commented on GitHub (Apr 29, 2023):

When running sudo tail -f /var/log/apache2/access.log it indeed does update when connecting to the instance.

Can you show the lines being logged? Just wanna see the response codes going back and what's being requested.

Maybe there's a way I can send you the backups privately and you can see what could be causing the issue?

I'm not sure the raw content will show issue, it's going to relate to the wider context of the machine/os/instance.

@ssddanbrown commented on GitHub (Apr 29, 2023): > When running sudo tail -f /var/log/apache2/access.log it indeed does update when connecting to the instance. Can you show the lines being logged? Just wanna see the response codes going back and what's being requested. > Maybe there's a way I can send you the backups privately and you can see what could be causing the issue? I'm not sure the raw content will show issue, it's going to relate to the wider context of the machine/os/instance.
Author
Owner

@Shisupun commented on GitHub (Apr 30, 2023):

When going to the URL that its supposed to be linked to, I get the response that the link refused to connect.
The output does not update.

When I go to the Public IP of the EC2 instance, I get the message that the link refused to connect, and the output does update.

Here's the output:
212.120.83.177 - - [30/Apr/2023:14:46:02 +0000] "GET / HTTP/1.1" 302 1887 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36"

Interesting to note, in both cases, the URL in the browser stays as the correct url. So when I go to it using the IP address, it changes to the URL and says that it refused to connect and EC2 instances updates live, while going to the url directly doesent update the ec2 instance live. But of course in both cases it does not seem to give an actual webpage.

@Shisupun commented on GitHub (Apr 30, 2023): When going to the URL that its supposed to be linked to, I get the response that the link refused to connect. The output does not update. When I go to the Public IP of the EC2 instance, I get the message that the link refused to connect, and the output does update. Here's the output: 212.120.83.177 - - [30/Apr/2023:14:46:02 +0000] "GET / HTTP/1.1" 302 1887 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36" Interesting to note, in both cases, the URL in the browser stays as the correct url. So when I go to it using the IP address, it changes to the URL and says that it refused to connect and EC2 instances updates live, while going to the url directly doesent update the ec2 instance live. But of course in both cases it does not seem to give an actual webpage.
Author
Owner

@ssddanbrown commented on GitHub (Apr 30, 2023):

@Shisupun Based upon that information, is sounds to me like the domain is not correctly pointed to the public IP of the machine being used. If you type the domain name into the input on this page, and press the "A" button, does it show your EC2 instance public IP address in the response text?

@ssddanbrown commented on GitHub (Apr 30, 2023): @Shisupun Based upon that information, is sounds to me like the domain is not correctly pointed to the public IP of the machine being used. If you type the domain name into the input [on this page](https://toolbox.googleapps.com/apps/dig/), and press the "A" button, does it show your EC2 instance public IP address in the response text?
Author
Owner

@Shisupun commented on GitHub (Apr 30, 2023):

@ssddanbrown Yes it does for A, and ANY.
For the other tabs it says "Record not found!"

@Shisupun commented on GitHub (Apr 30, 2023): @ssddanbrown Yes it does for A, and ANY. For the other tabs it says "Record not found!"
Author
Owner

@ssddanbrown commented on GitHub (Apr 30, 2023):

@Shisupun When you run the below command line, do you see the domain name or do you see the IP?

cat /etc/apache2/sites-available/bookstack.conf | grep ServerName
@ssddanbrown commented on GitHub (Apr 30, 2023): @Shisupun When you run the below command line, do you see the domain name or do you see the IP? ```bash cat /etc/apache2/sites-available/bookstack.conf | grep ServerName ```
Author
Owner

@Shisupun commented on GitHub (Apr 30, 2023):

@ssddanbrown I see "ServerName <mydomain.net>"
Where mydomain is in fact the correct domain that I want it to be pointing to. The text ServerName is in red.

@Shisupun commented on GitHub (Apr 30, 2023): @ssddanbrown I see "ServerName <mydomain.net>" Where mydomain is in fact the correct domain that I want it to be pointing to. The text ServerName is in red.
Author
Owner

@ssddanbrown commented on GitHub (May 1, 2023):

@Shisupun Huh, I was hoping it would show the IP as that would explain the issue.

When accessing via domain, have you tried specifically accessing via http://<domain> in the browser (Being sure there are no extensions active to force HTTPS usage?) Or are you using a domain (like .dev) which enforces https:// usage? And does teh APP_URL start with https:// or http://?

I'm just wondering if you're not seeing anything in the log upon domain access because something is forcing the connection from browser to be https while the webserver is only currently listening on http.

@ssddanbrown commented on GitHub (May 1, 2023): @Shisupun Huh, I was hoping it would show the IP as that would explain the issue. When accessing via domain, have you tried specifically accessing via `http://<domain>` in the browser (Being sure there are no extensions active to force HTTPS usage?) Or are you using a domain (like `.dev`) which enforces `https://` usage? And does teh `APP_URL` start with `https://` or `http://`? I'm just wondering if you're not seeing anything in the log upon domain access because something is forcing the connection from browser to be https while the webserver is only currently listening on http.
Author
Owner

@Shisupun commented on GitHub (May 1, 2023):

That seems to have been the issue. After restoring the site was not in Https with certifications but in http. My browser kept forcing me to see the https version. When I saw the http version it seemed similar to whats seen in the tutorial. After getting through that part it finally finally worked!

@Shisupun commented on GitHub (May 1, 2023): That seems to have been the issue. After restoring the site was not in Https with certifications but in http. My browser kept forcing me to see the https version. When I saw the http version it seemed similar to whats seen in the tutorial. After getting through that part it finally finally worked!
Author
Owner

@dannyjrr commented on GitHub (Nov 12, 2024):

Hello @ssddanbrown , I have the same issue but when I ran cat /etc/apache2/sites-available/bookstack.conf | grep ServerName it showed the IP instead of the domain

@dannyjrr commented on GitHub (Nov 12, 2024): Hello @ssddanbrown , I have the same issue but when I ran `cat /etc/apache2/sites-available/bookstack.conf | grep ServerName` it showed the IP instead of the domain
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#3768