snipe-it icon indicating copy to clipboard operation
snipe-it copied to clipboard

SQL Issues

Open ericdude101 opened this issue 12 years ago • 19 comments

I use SQL Server 2008 in my network and I updated the database .php file to reflect this, but when I run "php artisan app:install" it returns:

"Application key [HIDDEN] set successfully.

[InvalidArgumentException] Database [] not configured.

app:install C:\inetpub\techweb\snipe-it> "

Here is my database php file:

/* |-------------------------------------------------------------------------- | Default Database Connection Name |-------------------------------------------------------------------------- | | Here you may specify which of the database connections below you wish | to use as your default connection for all database work. Of course | you may use many connections at once using the Database library. | */

'default' => 'sqlsrv',

/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
|
*/

'connections' => array(

    'sqlite' => array(
        'driver'   => 'sqlite',
        'database' => __DIR__.'/../database/production.sqlite',
        'prefix'   => '',
    ),

    'mysql' => array(
        'driver'    => 'mysql',
        'host'      => 'localhost',
        'database'  => 'snipeit_laravel',
        'username'  => 'snipeit_laravel',
        'password'  => '',
        'charset'   => 'utf8',
        'collation' => 'utf8_unicode_ci',
        'prefix'    => '',
    ),

    'pgsql' => array(
        'driver'   => 'pgsql',
        'host'     => 'localhost',
        'database' => 'database',
        'username' => 'root',
        'password' => '',
        'charset'  => 'utf8',
        'prefix'   => '',
        'schema'   => 'public',
    ),

    'sqlsrv' => array(
        'driver'   => 'sqlsrv',
        'host'     => 'HIDDEN',
        'database' => 'snipeit',
        'username' => 'snipeit',
        'password' => 'HIDDEN',
        'prefix'   => '',
    ),

What do I need to do to get things working here?

ericdude101 avatar Nov 21 '14 20:11 ericdude101

What this usually means is that whatever environment your install thinks it's running in, there is no database.php in there. Where is that database.php file that you're referring to?

snipe avatar Nov 22 '14 04:11 snipe

it is under c:\inetpub\wwwroot\Snipe-it\app\config\local\

ericdude101 avatar Nov 22 '14 04:11 ericdude101

Can you confirm that your app actually thinks it's in local mode?

If the hostname in the bootstrap/start.php doesn't match the actual hostname, it will default to production.

Can you show me what you have in that file for:

    $env = $app->detectEnvironment(array(

        'local'         => array('YourLocalDevHostname','AlisonMBP'),
        'staging'       => array('staging.yourserver.com'),
        'production'    => array('www.yourserver.com')
    ));

snipe avatar Nov 22 '14 04:11 snipe

(Another way to tell is if the debugbar is showing up - it won't show up in production mode)

Or you can just move the database.php into app/config. That should also work.

snipe avatar Nov 22 '14 04:11 snipe

I did determine that it was trying to use the production environment. However now running the same install command, I am getting an error from line 99 in the database.php file: PHP Parse error: syntax error, unexpected 'migrations' (T_STRING), expecting ')

ericdude101 avatar Nov 24 '14 04:11 ericdude101

I've honestly never tried this with SQL server, but that's a PHP Parse error. Can you confirm what version of PHP you're using?

snipe avatar Nov 24 '14 04:11 snipe

(Also, can you show me what line 90-100 are in that file for you? Obv obscure any passwords)

snipe avatar Nov 24 '14 05:11 snipe

It just contains: 'migrations' => 'migrations',

ericdude101 avatar Nov 24 '14 14:11 ericdude101

The PHP version on the server is 5.6.3

ericdude101 avatar Nov 24 '14 14:11 ericdude101

Any updates in regards to this?

ericdude101 avatar Nov 29 '14 20:11 ericdude101

Can you give that line along with a few lines before, and a few lines after - for context?

I wonder if there's a syntax error on the previous line, which is why it's erroring on that line.

uberbrady avatar Nov 30 '14 00:11 uberbrady

Here are lines 90-105

| Migration Repository Table |-------------------------------------------------------------------------- | | This table keeps track of all the migrations that have already run for | your application. Using this information, we can determine which of | the migrations on disk have not actually be run in the databases. | */

'migrations' => 'migrations',

/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|

ericdude101 avatar Dec 01 '14 18:12 ericdude101

Was able to get that taken care of, now im getting an SQL error.

Step: 2

Preparing your Application

Application key [HIDDEN] set successfully. Migration table created successfully. Migrated: 2012_12_06_225921_migration_cartalyst_sentry_install_users Migrated: 2012_12_06_225929_migration_cartalyst_sentry_install_groups Migrated: 2012_12_06_225945_migration_cartalyst_sentry_install_users_groups_pivo t Migrated: 2012_12_06_225988_migration_cartalyst_sentry_install_throttle

[Illuminate\Database\QueryException]

SQLSTATE[42000]: [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Inco rrect syntax near 'MODIFY'. (SQL: ALTER TABLE users MODIFY phone varchar(20 ) null)

app:install

ericdude101 avatar Dec 01 '14 21:12 ericdude101

Did you get the problem "Incorrect syntax near 'MODIFY'" fixed?

DarkDevil68 avatar Dec 12 '14 18:12 DarkDevil68

I am having this exact same issue. Could anyone answer this?

Application key [HIDDEN] set successfully. Migration table created successfully. Migrated: 2012_12_06_225921_migration_cartalyst_sentry_install_users Migrated: 2012_12_06_225929_migration_cartalyst_sentry_install_groups Migrated: 2012_12_06_225945_migration_cartalyst_sentry_install_users_groups_pivo t Migrated: 2012_12_06_225988_migration_cartalyst_sentry_install_throttle

[Illuminate\Database\QueryException]

SQLSTATE[42000]: [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Inco rrect syntax near 'MODIFY'. (SQL: ALTER TABLE users MODIFY phone varchar(20 ) null)

app:install

wsutton74 avatar Dec 31 '14 16:12 wsutton74

Not sure this will work with SQL Server. The MODIFY syntax doesn't exist in SQL server.

snipe avatar Feb 11 '15 12:02 snipe

Hello. Has this been fixed? If sql server is not supported it would be nice if the documentation would say so. That way we wouldn't waste time attempting. Alternatively, it would be great if it worked...

ghost avatar Jul 30 '15 14:07 ghost

The requirements specify MySQL or MariaDB

snipe avatar Jul 30 '15 16:07 snipe

The sqlsrv connection info inside of database.php is a little misleading. I ended up using MySQL. Thanks for the quick response. The site is great.

ghost avatar Jul 30 '15 18:07 ghost