artisan migrate failed on update #2680

Closed
opened 2026-02-05 04:46:41 +03:00 by OVERLORD · 9 comments
Owner

Originally created by @taophp on GitHub (Feb 28, 2022).

Describe the Bug

As usual, I updated my Bookstack instance running this command this morning:

git pull origin release && \
/opt/php/bin/composer2 install --no-dev && \
php artisan migrate && \
php artisan cache:clear && \
php artisan config:clear && \
php artisan view:clear

Then I got this error, comming fro the migrate part:

In Connection.php line 712:

  SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from inform
  ation_schema.tables where table_schema = vg6lc_codex and table_name = migra
  tions and table_type = 'BASE TABLE')


In Connector.php line 70:

  SQLSTATE[HY000] [2002] No such file or directory

Steps to Reproduce

Juste redo the php artisan migrate command

Expected Behaviour

Update with no error

Screenshots or Additional Context

No response

Browser Details

No response

Exact BookStack Version

22.02.1 currently shown in the back office

PHP Version

8.0.15

Hosting Environment

Debian GNU/Linux 8.11 (jessie)

Originally created by @taophp on GitHub (Feb 28, 2022). ### Describe the Bug As usual, I updated my Bookstack instance running this command this morning: ``` git pull origin release && \ /opt/php/bin/composer2 install --no-dev && \ php artisan migrate && \ php artisan cache:clear && \ php artisan config:clear && \ php artisan view:clear ``` Then I got this error, comming fro the migrate part: ``` In Connection.php line 712: SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from inform ation_schema.tables where table_schema = vg6lc_codex and table_name = migra tions and table_type = 'BASE TABLE') In Connector.php line 70: SQLSTATE[HY000] [2002] No such file or directory ``` ### Steps to Reproduce Juste redo the `php artisan migrate` command ### Expected Behaviour Update with no error ### Screenshots or Additional Context _No response_ ### Browser Details _No response_ ### Exact BookStack Version 22.02.1 currently shown in the back office ### PHP Version 8.0.15 ### Hosting Environment Debian GNU/Linux 8.11 (jessie)
OVERLORD added the 🐕 Support label 2026-02-05 04:46:41 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Feb 28, 2022):

Hi @taophp,
Does the instance of BookStack otherwise function correctly?
Have you made other changes recently? PHP version?

Based on the error, the application from the command line cannot successfully access the database. This is common when the database credentials are incorrect. I'd expect that the BookStack instance would be broken also.

@ssddanbrown commented on GitHub (Feb 28, 2022): Hi @taophp, Does the instance of BookStack otherwise function correctly? Have you made other changes recently? PHP version? Based on the error, the application from the command line cannot successfully access the database. This is common when the database credentials are incorrect. I'd expect that the BookStack instance would be broken also.
Author
Owner

@taophp commented on GitHub (Feb 28, 2022):

Hi @ssddanbrown and thanks for your quick answer !

Does the instance of BookStack otherwise function correctly?

It seems so, yes.

Have you made other changes recently?

No.

PHP version?

8.0.15

Based on the error, the application from the command line cannot successfully access the database. This is common when the database credentials are incorrect. I'd expect that the BookStack instance would be broken also.

It's been 6 months I used the same way to update my instance of BookStack, and this error never occurred before.

@taophp commented on GitHub (Feb 28, 2022): Hi @ssddanbrown and thanks for your quick answer ! > Does the instance of BookStack otherwise function correctly? It seems so, yes. > Have you made other changes recently? No. > PHP version? 8.0.15 > Based on the error, the application from the command line cannot successfully access the database. This is common when the database credentials are incorrect. I'd expect that the BookStack instance would be broken also. It's been 6 months I used the same way to update my instance of BookStack, and this error never occurred before.
Author
Owner

@ssddanbrown commented on GitHub (Feb 28, 2022):

Very strange.

  • Does running php artisan down work okay and show a "BookStack is down right now" page?
    • You can run php artisan up afterwards to bring things back up and working again.
  • Have you updated that version of PHP recently? I noticed it's quite recent and not one I'd expect to be provided with common repos for Debian Jessie.
  • Have you ever attempted any customizations or other config changes in your BookStack instance?
@ssddanbrown commented on GitHub (Feb 28, 2022): Very strange. - Does running `php artisan down` work okay and show a "BookStack is down right now" page? - You can run `php artisan up` afterwards to bring things back up and working again. - Have you updated that version of PHP recently? I noticed it's quite recent and not one I'd expect to be provided with common repos for Debian Jessie. - Have you ever attempted any customizations or other config changes in your BookStack instance?
Author
Owner

@taophp commented on GitHub (Mar 1, 2022):

php artisan down and up work as expected. I did not update the version of PHP ever on this server. And I did not attempt any customization or other config changes recently. The fact is that I was not involved when the instance of Bookstack was created, and the person who did it had now leave the company : I may be unaware of some changes he may have done at the time... but it's been months now that I update BookStack without any trouble.

@taophp commented on GitHub (Mar 1, 2022): `php artisan down` and `up` work as expected. I did not update the version of PHP ever on this server. And I did not attempt any customization or other config changes recently. The fact is that I was not involved when the instance of Bookstack was created, and the person who did it had now leave the company : I may be unaware of some changes he may have done at the time... but it's been months now that I update BookStack without any trouble.
Author
Owner

@ssddanbrown commented on GitHub (Mar 2, 2022):

Okay.

There's two things that I can think of that are most likely to cause this kind of behaviour:

  1. You're running commands for a different instance of BookStack than the one you're viewing on the web (Has happened before).
  2. The version and configuration of PHP used on the command line may differ to that running on the webserver. This is a somewhat common issue but I've never seen it affect database usage although it's definitely possible.

The php artisan down check was to check point 1. Assuming you saw the BookStack instance go down in the browser, then you're interacting with the right instance.

I'm still a bit suspicious in regards to point 2 above. You've got a version of PHP from end of last month, on quite an old operating system version. I don't think the popular non-system-package repo (deb.sury.org supports Jessie for PHP 8).

  • Can you provide the output of running ls -alh /usr/lib/php/ on the machine?
  • What happens when running php artisan migrate:status?
@ssddanbrown commented on GitHub (Mar 2, 2022): Okay. There's two things that I can think of that are most likely to cause this kind of behaviour: 1. You're running commands for a different instance of BookStack than the one you're viewing on the web (Has happened before). 2. The version and configuration of PHP used on the command line may differ to that running on the webserver. This is a somewhat common issue but I've never seen it affect database usage although it's definitely possible. The `php artisan down` check was to check point 1. Assuming you saw the BookStack instance go down in the browser, then you're interacting with the right instance. I'm still a bit suspicious in regards to point 2 above. You've got a version of PHP from end of last month, on quite an old operating system version. I don't think the popular non-system-package repo (`deb.sury.org` supports Jessie for PHP 8). - Can you provide the output of running `ls -alh /usr/lib/php/` on the machine? - What happens when running `php artisan migrate:status`?
Author
Owner

@taophp commented on GitHub (Mar 2, 2022):

I found it, thanks to your help ! You were right when you wrote that the version of PHP may differ. In fact, the site runs on PHP 7.4, that I was able to check from the administration interface of our web host (this is a managed server, I cannot be root or directly view configuration files).

I am not allowed to run ks -alh /usr/lib/php, it is a managed server, and, sadly, I am not root.
migrate give me this with php 8.0.15 :

$ php artisan migrate:status

In Connection.php line 712:

  SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from inform
  ation_schema.tables where table_schema = vg6lc_codex and table_name = migra
  tions and table_type = 'BASE TABLE')


In Connector.php line 70:

  SQLSTATE[HY000] [2002] No such file or directory

but it works well with PHP 7-4:

$ php-7.4 artisan migrate:status
+------+------------------------------------------------------+-------+
| Ran? | Migration                                            | Batch |
+------+------------------------------------------------------+-------+
| Yes  | 2014_10_12_000000_create_users_table                 | 1     |
| Yes  | 2014_10_12_100000_create_password_resets_table       | 1     |
| Yes  | 2015_07_12_114933_create_books_table                 | 1     |
| Yes  | 2015_07_12_190027_create_pages_table                 | 1     |
| Yes  | 2015_07_13_172121_create_images_table                | 1     |
| Yes  | 2015_07_27_172342_create_chapters_table              | 1     |
| Yes  | 2015_08_08_200447_add_users_to_entities              | 1     |
| Yes  | 2015_08_09_093534_create_page_revisions_table        | 1     |
| Yes  | 2015_08_16_142133_create_activities_table            | 1     |
| Yes  | 2015_08_29_105422_add_roles_and_permissions          | 1     |
| Yes  | 2015_08_30_125859_create_settings_table              | 1     |
| Yes  | 2015_08_31_175240_add_search_indexes                 | 1     |
| Yes  | 2015_09_04_165821_create_social_accounts_table       | 1     |
| Yes  | 2015_09_05_164707_add_email_confirmation_table       | 1     |
| Yes  | 2015_11_21_145609_create_views_table                 | 1     |
| Yes  | 2015_11_26_221857_add_entity_indexes                 | 1     |
| Yes  | 2015_12_05_145049_fulltext_weighting                 | 1     |
| Yes  | 2015_12_07_195238_add_image_upload_types             | 1     |
| Yes  | 2015_12_09_195748_add_user_avatars                   | 1     |
| Yes  | 2016_01_11_210908_add_external_auth_to_users         | 1     |
| Yes  | 2016_02_25_184030_add_slug_to_revisions              | 1     |
| Yes  | 2016_02_27_120329_update_permissions_and_roles       | 1     |
| Yes  | 2016_02_28_084200_add_entity_access_controls         | 1     |
| Yes  | 2016_03_09_203143_add_page_revision_types            | 1     |
| Yes  | 2016_03_13_082138_add_page_drafts                    | 1     |
| Yes  | 2016_03_25_123157_add_markdown_support               | 1     |
| Yes  | 2016_04_09_100730_add_view_permissions_to_roles      | 1     |
| Yes  | 2016_04_20_192649_create_joint_permissions_table     | 1     |
| Yes  | 2016_05_06_185215_create_tags_table                  | 1     |
| Yes  | 2016_07_07_181521_add_summary_to_page_revisions      | 1     |
| Yes  | 2016_09_29_101449_remove_hidden_roles                | 1     |
| Yes  | 2016_10_09_142037_create_attachments_table           | 1     |
| Yes  | 2017_01_21_163556_create_cache_table                 | 1     |
| Yes  | 2017_01_21_163602_create_sessions_table              | 1     |
| Yes  | 2017_03_19_091553_create_search_index_table          | 1     |
| Yes  | 2017_04_20_185112_add_revision_counts                | 1     |
| Yes  | 2017_07_02_152834_update_db_encoding_to_ut8mb4       | 1     |
| Yes  | 2017_08_01_130541_create_comments_table              | 1     |
| Yes  | 2017_08_29_102650_add_cover_image_display            | 1     |
| Yes  | 2018_07_15_173514_add_role_external_auth_id          | 1     |
| Yes  | 2018_08_04_115700_create_bookshelves_table           | 1     |
| Yes  | 2019_07_07_112515_add_template_support               | 1     |
| Yes  | 2019_08_17_140214_add_user_invites_table             | 1     |
| Yes  | 2019_12_29_120917_add_api_auth                       | 1     |
| Yes  | 2020_08_04_111754_drop_joint_permissions_id          | 1     |
| Yes  | 2020_08_04_131052_remove_role_name_field             | 1     |
| Yes  | 2020_09_19_094251_add_activity_indexes               | 1     |
| Yes  | 2020_09_27_210059_add_entity_soft_deletes            | 2     |
| Yes  | 2020_09_27_210528_create_deletions_table             | 2     |
| Yes  | 2020_11_07_232321_simplify_activities_table          | 2     |
| Yes  | 2020_12_30_173528_add_owned_by_field_to_entities     | 2     |
| Yes  | 2021_01_30_225441_add_settings_type_column           | 2     |
| Yes  | 2021_03_08_215138_add_user_slug                      | 2     |
| Yes  | 2021_05_15_173110_create_favourites_table            | 2     |
| Yes  | 2021_06_30_173111_create_mfa_values_table            | 2     |
| Yes  | 2021_07_03_085038_add_mfa_enforced_to_roles_table    | 2     |
| Yes  | 2021_08_28_161743_add_export_role_permission         | 2     |
| Yes  | 2021_09_26_044614_add_activities_ip_column           | 2     |
| Yes  | 2021_11_26_070438_add_index_for_user_ip              | 3     |
| Yes  | 2021_12_07_111343_create_webhooks_table              | 3     |
| Yes  | 2021_12_13_152024_create_jobs_table                  | 3     |
| Yes  | 2021_12_13_152120_create_failed_jobs_table           | 3     |
| Yes  | 2022_01_03_154041_add_webhooks_timeout_error_columns | 4     |
+------+------------------------------------------------------+-------+

Thanks a lot !

@taophp commented on GitHub (Mar 2, 2022): I found it, thanks to your help ! You were right when you wrote that the version of PHP may differ. In fact, the site runs on PHP 7.4, that I was able to check from the administration interface of our web host (this is a managed server, I cannot be root or directly view configuration files). I am not allowed to run `ks -alh /usr/lib/php`, it is a managed server, and, sadly, I am not root. migrate give me this with php 8.0.15 : ``` $ php artisan migrate:status In Connection.php line 712: SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from inform ation_schema.tables where table_schema = vg6lc_codex and table_name = migra tions and table_type = 'BASE TABLE') In Connector.php line 70: SQLSTATE[HY000] [2002] No such file or directory ``` but it works well with PHP 7-4: ``` $ php-7.4 artisan migrate:status +------+------------------------------------------------------+-------+ | Ran? | Migration | Batch | +------+------------------------------------------------------+-------+ | Yes | 2014_10_12_000000_create_users_table | 1 | | Yes | 2014_10_12_100000_create_password_resets_table | 1 | | Yes | 2015_07_12_114933_create_books_table | 1 | | Yes | 2015_07_12_190027_create_pages_table | 1 | | Yes | 2015_07_13_172121_create_images_table | 1 | | Yes | 2015_07_27_172342_create_chapters_table | 1 | | Yes | 2015_08_08_200447_add_users_to_entities | 1 | | Yes | 2015_08_09_093534_create_page_revisions_table | 1 | | Yes | 2015_08_16_142133_create_activities_table | 1 | | Yes | 2015_08_29_105422_add_roles_and_permissions | 1 | | Yes | 2015_08_30_125859_create_settings_table | 1 | | Yes | 2015_08_31_175240_add_search_indexes | 1 | | Yes | 2015_09_04_165821_create_social_accounts_table | 1 | | Yes | 2015_09_05_164707_add_email_confirmation_table | 1 | | Yes | 2015_11_21_145609_create_views_table | 1 | | Yes | 2015_11_26_221857_add_entity_indexes | 1 | | Yes | 2015_12_05_145049_fulltext_weighting | 1 | | Yes | 2015_12_07_195238_add_image_upload_types | 1 | | Yes | 2015_12_09_195748_add_user_avatars | 1 | | Yes | 2016_01_11_210908_add_external_auth_to_users | 1 | | Yes | 2016_02_25_184030_add_slug_to_revisions | 1 | | Yes | 2016_02_27_120329_update_permissions_and_roles | 1 | | Yes | 2016_02_28_084200_add_entity_access_controls | 1 | | Yes | 2016_03_09_203143_add_page_revision_types | 1 | | Yes | 2016_03_13_082138_add_page_drafts | 1 | | Yes | 2016_03_25_123157_add_markdown_support | 1 | | Yes | 2016_04_09_100730_add_view_permissions_to_roles | 1 | | Yes | 2016_04_20_192649_create_joint_permissions_table | 1 | | Yes | 2016_05_06_185215_create_tags_table | 1 | | Yes | 2016_07_07_181521_add_summary_to_page_revisions | 1 | | Yes | 2016_09_29_101449_remove_hidden_roles | 1 | | Yes | 2016_10_09_142037_create_attachments_table | 1 | | Yes | 2017_01_21_163556_create_cache_table | 1 | | Yes | 2017_01_21_163602_create_sessions_table | 1 | | Yes | 2017_03_19_091553_create_search_index_table | 1 | | Yes | 2017_04_20_185112_add_revision_counts | 1 | | Yes | 2017_07_02_152834_update_db_encoding_to_ut8mb4 | 1 | | Yes | 2017_08_01_130541_create_comments_table | 1 | | Yes | 2017_08_29_102650_add_cover_image_display | 1 | | Yes | 2018_07_15_173514_add_role_external_auth_id | 1 | | Yes | 2018_08_04_115700_create_bookshelves_table | 1 | | Yes | 2019_07_07_112515_add_template_support | 1 | | Yes | 2019_08_17_140214_add_user_invites_table | 1 | | Yes | 2019_12_29_120917_add_api_auth | 1 | | Yes | 2020_08_04_111754_drop_joint_permissions_id | 1 | | Yes | 2020_08_04_131052_remove_role_name_field | 1 | | Yes | 2020_09_19_094251_add_activity_indexes | 1 | | Yes | 2020_09_27_210059_add_entity_soft_deletes | 2 | | Yes | 2020_09_27_210528_create_deletions_table | 2 | | Yes | 2020_11_07_232321_simplify_activities_table | 2 | | Yes | 2020_12_30_173528_add_owned_by_field_to_entities | 2 | | Yes | 2021_01_30_225441_add_settings_type_column | 2 | | Yes | 2021_03_08_215138_add_user_slug | 2 | | Yes | 2021_05_15_173110_create_favourites_table | 2 | | Yes | 2021_06_30_173111_create_mfa_values_table | 2 | | Yes | 2021_07_03_085038_add_mfa_enforced_to_roles_table | 2 | | Yes | 2021_08_28_161743_add_export_role_permission | 2 | | Yes | 2021_09_26_044614_add_activities_ip_column | 2 | | Yes | 2021_11_26_070438_add_index_for_user_ip | 3 | | Yes | 2021_12_07_111343_create_webhooks_table | 3 | | Yes | 2021_12_13_152024_create_jobs_table | 3 | | Yes | 2021_12_13_152120_create_failed_jobs_table | 3 | | Yes | 2022_01_03_154041_add_webhooks_timeout_error_columns | 4 | +------+------------------------------------------------------+-------+ ``` Thanks a lot !
Author
Owner

@ssddanbrown commented on GitHub (Mar 2, 2022):

@taophp Great! happy to hear we found the issue.

The lack of functionality for the PHP8 version may be due to a difference of extensions or confirmation.

Just a warning, PHP8 will probably become the minimum supported version of PHP for BookStack early next year, or maybe even end of this year. Hopefully newer versions will be supported on your managed provider by then.

@ssddanbrown commented on GitHub (Mar 2, 2022): @taophp Great! happy to hear we found the issue. The lack of functionality for the PHP8 version may be due to a difference of extensions or confirmation. Just a warning, PHP8 will probably become the minimum supported version of PHP for BookStack early next year, or maybe even end of this year. Hopefully newer versions will be supported on your managed provider by then.
Author
Owner

@athornfam2 commented on GitHub (Jan 20, 2023):

@ssddanbrown Getting the same error here but on PHP 8.1.14

`root@bookstack:/var/www/bookstack# php -v

PHP 8.1.14 (cli) (built: Jan 13 2023 10:43:22) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.14, Copyright (c) Zend Technologies
with Zend OPcache v8.1.14, Copyright (c), by Zend Technologies
You have new mail in /var/mail/root
root@bookstack:/var/www/bookstack# php artisan migrate:status

In Connection.php line 712:

could not find driver (SQL: select * from information_schema.tables where t
able_schema = bookstack and table_name = migrations and table_type = 'BASE
TABLE')

In Connector.php line 70:

could not find driver

You have new mail in /var/mail/root`

@athornfam2 commented on GitHub (Jan 20, 2023): @ssddanbrown Getting the same error here but on PHP 8.1.14 `root@bookstack:/var/www/bookstack# php -v PHP 8.1.14 (cli) (built: Jan 13 2023 10:43:22) (NTS) Copyright (c) The PHP Group Zend Engine v4.1.14, Copyright (c) Zend Technologies with Zend OPcache v8.1.14, Copyright (c), by Zend Technologies You have new mail in /var/mail/root root@bookstack:/var/www/bookstack# php artisan migrate:status In Connection.php line 712: could not find driver (SQL: select * from information_schema.tables where t able_schema = bookstack and table_name = migrations and table_type = 'BASE TABLE') In Connector.php line 70: could not find driver You have new mail in /var/mail/root`
Author
Owner

@ssddanbrown commented on GitHub (Jan 20, 2023):

@athornfam2 Ensure you have the php8.1-mysql package installed on your system.
If you need further help, Please open a new support issue since this will be system-dependent, so it'll be useful to get details on your specific environment.

@ssddanbrown commented on GitHub (Jan 20, 2023): @athornfam2 Ensure you have the `php8.1-mysql` package installed on your system. If you need further help, Please open a new support issue since this will be system-dependent, so it'll be useful to get details on your specific environment.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#2680