Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mustafaabdujalil's avatar

I got error on php artisan migrate

I got a error when I try to do php artisan migrate on my production server

In ArgvInput.php line 261:

Invalid argument supplied for foreach()

X-Powered-By: PHP/7.2.20 Content-type: text/html; charset=UTF-8

0 likes
8 replies
Nakov's avatar

And the error is?

Or is it just a question if you really want to run the migrations because it is a production environment? :)

Snapey's avatar

Oh dear. An error! Whatever could it be?

Nakov's avatar

@mustafaabdujalil this is not enough, not knowing if you use any package.. not run composer install or sharing the migration file that throws the error..

mustafaabdujalil's avatar

this is the migration file and i run the this command (php artisan migrate) it's working well on local but on server gives me mentioned error

<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AlterCountriesTableAddColNameAr extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('countries', function (Blueprint $table) {
            $table->string('name_ar')->nullable()->after('name');
        });
        Schema::table('cities', function (Blueprint $table) {
            $table->string('name_ar')->nullable()->after('name');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('countries', function (Blueprint $table) {
            $table->dropColumn('name_ar');
        });

        Schema::table('cities', function (Blueprint $table) {
            $table->dropColumn('name_ar');
        });
    }
}
Nakov's avatar

The error does not seems to come from this migration file..

Run composer dump-autoload and php artisan cache:clear

Snapey's avatar

Do you get this error with other artisan commands?

mustafaabdujalil's avatar
Level 2

I solved it by this command and all artisan commands at this case solved like this

php-cli artisan migrate

Please or to participate in this conversation.