pixelfed / support

Issue tracker for installations of Pixelfed, before a bug is identified.
https://docs.pixelfed.org/running-pixelfed/troubleshooting.html
8 stars 3 forks source link

Database connection Error! #121

Open gensisco opened 3 years ago

gensisco commented 3 years ago

Hi , friends i have a problem with running my own instance when i run this commands i find that DB is not connected i got this errors one time with sudo and the another without it can you help me thanks

~/pixelfed> sudo php artisan migrate

**************************************
*     Application In Production!     *
**************************************

 Do you really wish to run this command? (yes/no) [no]:
 > yes

   Illuminate\Database\QueryException 

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

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:678
    674▕         // If an exception occurs when attempting to run a query, we'll format the error
    675▕         // message to include the bindings with SQL, which will make this exception a
    676▕         // lot more helpful to the developer instead of just the database's errors.
    677▕         catch (Exception $e) {
  ➜ 678▕             throw new QueryException(
    679▕                 $query, $this->prepareBindings($bindings), $e
    680▕             );
    681▕         }
    682▕ 

      +36 vendor frames 
  37  artisan:37
      Illuminate\Foundation\Console\Kernel::handle()
~/pixelfed>  php artisan migrate
**************************************
*     Application In Production!     *
**************************************

 Do you really wish to run this command? (yes/no) [no]:
 > yes

   UnexpectedValueException 

  The stream or file "/home/l/pixelfed/storage/logs/laravel.log" could not be opened in append mode: failed to open stream: Permission denied

  at vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:111
    107▕             restore_error_handler();
    108▕             if (!is_resource($this->stream)) {
    109▕                 $this->stream = null;
    110▕ 
  ➜ 111▕                 throw new \UnexpectedValueException(sprintf('The stream or file "%s" could not be opened in append mode: '.$this->errorMessage, $this->url));
    112▕             }
    113▕         }
    114▕ 
    115▕         if ($this->useLocking) {

      +7 vendor frames 
  8   app/Exceptions/Handler.php:38
      Illuminate\Foundation\Exceptions\Handler::report()

      +2 vendor frames 
  11  [internal]:0
      Illuminate\Foundation\Bootstrap\HandleExceptions::handleException()

sudo php artisan migrate

**************************************
*     Application In Production!     *
**************************************

 Do you really wish to run this command? (yes/no) [no]:
 > yes

   Illuminate\Database\QueryException 

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

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:678
    674▕         // If an exception occurs when attempting to run a query, we'll format the error
    675▕         // message to include the bindings with SQL, which will make this exception a
    676▕         // lot more helpful to the developer instead of just the database's errors.
    677▕         catch (Exception $e) {
  ➜ 678▕             throw new QueryException(
    679▕                 $query, $this->prepareBindings($bindings), $e
    680▕             );
    681▕         }
    682▕ 

      +36 vendor frames 
  37  artisan:37
      Illuminate\Foundation\Console\Kernel::handle()
~/pixelfed> 

I hope you help me to install pixelfed its too hard to install thanks

spacecowb0y commented 3 years ago

Hi @igensis, did you try to run:

docker-compose down -v
docker-compose up -d

I was having the same issue, and it looks like its related on how the network is created. Taking the containers down and up again fixed the issue for me. I hope it works for you as well.

gensisco commented 3 years ago

Thanks @spacecowb0y for your reply but i not running with docker i'm using manual guide can you provide me a doc with docker guide

trwnh commented 3 years ago

you have an issue with connecting to a database -- check your DB_* variables in .env

gensisco commented 3 years ago

thanks @trwnh my DB info is correct and i have done this both using mysql and postgresql and i have the same problem

spacecowb0y commented 3 years ago

Thanks @spacecowb0y for your reply but i not running with docker i'm using manual guide can you provide me a doc with docker guide

I'm planning on writing a detailed guide on how to install it using Docker. For some unknown reason is missing in docs at the moment.

Gazimoff commented 1 year ago

Check that you have the PHP mysql driver installed:

$ sudo apt install php-mysql