0

I have a Laravel 4 db:seed file that I am trying to use on mediatemple gridserver. I was able to run a migration with artisan fine (php artisan migrate), and make the tables, but I am not able to seed the tables. This database seeding worked fine on local host. It is only now on a live server that I am experiencing any issues with it. Here is the seed file:

ArtistsTableSeeder.php:

class ArtistsTableSeeder extends Seeder {

    public function run()
    {
        // Uncomment the below to wipe the table clean before populating
        // DB::table('artists')->delete();

        $artists = array(

        );

        $Artists = [
            ['stage_name' => 'Blah', 'city' => 'Blah', 'state' => 'blah', 'video_path' => 'youtube.com', 'image_path' => 'filepickerimage', 'soundcloud_profile' => 'https://soundcloud.com/', 'description' => '', 'created_at' => new DateTime, 'updated_at' => new DateTime]


        ];

        // Uncomment the below to run the seeder
        DB::table('artists')->insert($Artists);
    }

}

It is spitting out this error:

{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"syntax error, unexpected '['","file":"\/nfs\/c09\/h04\/mnt\/139243\/domains\/crowdsets.com\/html\/app\/database\/seeds\/ArtistsTableSeeder.php","linemichaelsutyak.com@n26:/home/139243/domains/crowdsets.com/html$ php artisan db:seed

It is complaining about the line that starts the array:

$Artists = [

I have no idea why this is happening. A little help would be appreciated. Thank you!

Antonio Carlos Ribeiro
  • 86,191
  • 22
  • 213
  • 204
user1072337
  • 12,615
  • 37
  • 116
  • 195

1 Answers1

4

That syntax error you get is probably caused by a feature that has been added in PHP 5.4 (short array syntax), so I'd guess your hoster still runs 5.3.x. You should check the PHP version on the mediatemple grid server and update it if necessary.

ciruvan
  • 5,143
  • 1
  • 26
  • 32
  • Worst comes to worst, you can simply change any instance of `[...]` to `array(...)` in your code. Laravel is all php 5.3 compliant - it doesn't use any 5.4 specific syntax. – fideloper Jul 11 '13 at 13:15
  • On mediatemple, it gave me the option for my domains to use php 5.3.6 or 5.5.0. When I use 5.5.0, I still get the same syntax error. – user1072337 Jul 11 '13 at 13:41
  • I cannot restart the server using gridserver on media temple..i'm still getting the error – user1072337 Jul 16 '13 at 23:08