eraporsmk / erapor6

Aplikasi Penilaian Direktorat SMK
Other
36 stars 34 forks source link

`composer install` gagal pada composer script `@php artisan package:discover --ansi` #98

Closed janglapuk closed 1 year ago

janglapuk commented 1 year ago

Saya baru coba install di clean VPS (linux), seluruh requirement sudah dipenuhi. Namun bermasalah saat saat install composer packages.

Langkah yang telah diikuti:

git clone --depth=1 https://github.com/eraporsmk/erapor6.git erapor6
cd erapor6

cp .env.example .env
nano .env
erapor6@erapor6:~/apps/erapor6$ php -v
PHP 7.4.33 (cli) (built: Nov  8 2022 11:33:17) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.33, Copyright (c), by Zend Technologies

Namun saat install required packages menggunakan composer dengan perintah:

composer install

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

erapor6@erapor6:~/apps/erapor6$ composer install
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Nothing to install, update or remove
Package box/spout is abandoned, you should avoid using it. No replacement was suggested.
Package swiftmailer/swiftmailer is abandoned, you should avoid using it. Use symfony/mailer instead.
Generating optimized autoload files
Class App\View\Components\inputs located in ./app/View/Components/inputs.date.php does not comply with psr-4 autoloading standard. Skipping.
Class App\Helpers\Helper located in ./app/Helpers/helpers.php does not comply with psr-4 autoloading standard. Skipping.
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

   Illuminate\Database\QueryException 

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

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:712
    708▕         // If an exception occurs when attempting to run a query, we'll format the error
    709▕         // message to include the bindings with SQL, which will make this exception a
    710▕         // lot more helpful to the developer instead of just the database's errors.
    711▕         catch (Exception $e) {
  ➜ 712▕             throw new QueryException(
    713▕                 $query, $this->prepareBindings($bindings), $e
    714▕             );
    715▕         }
    716▕     }

  1   [internal]:0
      Illuminate\Foundation\Application::Illuminate\Foundation\{closure}()

      +2 vendor frames 
  4   [internal]:0
      Illuminate\Foundation\Application::Illuminate\Foundation\{closure}()
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

Bahkan untuk menjalankan perintah php artisan <apapun> selalu memiliki pesan kesalahan yang sama, seperti perintah berikut:

atau

Tambahan

Saya sudah mengatur .env pada bagian database driver, seperti:

DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=erapor6
DB_USERNAME=erapor6
DB_PASSWORD=***REDACTED***

dan menguji credential database-nya dengan sukses

erapor6@erapor6:~/apps/erapor6$ PGPASSWORD=***REDACTED*** psql -U erapor6 erapor6
psql (10.22 (Ubuntu 10.22-0ubuntu0.18.04.1))
Type "help" for help.

erapor6=> \du
                                   List of roles
 Role name |                         Attributes                         | Member of 
-----------+------------------------------------------------------------+-----------
 erapor6   | Create role, Create DB                                     | {}
 postgres  | Superuser, Create role, Create DB, Replication, Bypass RLS | {}

erapor6=> \l
                                  List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   
-----------+----------+----------+-------------+-------------+-----------------------
 erapor6   | erapor6  | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
 template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
(4 rows)

erapor6=>

Mohon masukannya dan saran perbaikan jika ada langkah yang keliru saya lakukan.

Terima kasih.

janglapuk commented 1 year ago

Maaf, ternyata saya lupa untuk memenuhi PHP extension postgresql, seperti:

$ sudo apt install php7.4-pgsql

Closed.

edi2015 commented 1 year ago

gan, saya juga mengalami ini. mohon bantuannya

janglapuk commented 1 year ago

gan, saya juga mengalami ini. mohon bantuannya

Pastikan PHP extension untuk database postgresql sudah terpasang di file php.ini.

Contoh di Windows:

extension=php_pgsql.dll

Contoh di Linux:

extension=php_pgsql.so

Solusinya (pada Linux) lihat komentar sebelumnya.

edi2015 commented 1 year ago

sdh berhasil semua gan

edi2015 commented 1 year ago

untuk menampilkan login page gmn ya gan http://erapor.smkn2-pas.sch.id/

masih blm running gan