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

ycsm's avatar
Level 1

Laravel not running on live hosting: array_merge(): Argument #1 must be of type array, int given

Hi all.

For reasons that are out of my control, I need to host my Laravel project on cPanel. I have done this easily before with Laravel 8. I just do an .htaccess edit to tell the browser that the public folder is the "public" folder.

However, I've come to upload a Laravel 10 project. I'm getting this error:

array_merge(): Argument #1 must be of type array, int given

On this line of code:

$app = require_once __DIR__.'/../bootstrap/app.php';
$kernel = $app->make(Kernel::class);

$response = $kernel->handle(    <-------- HERE
			$request = Request::capture()
)->send();

$kernel->terminate($request, $response);

Here is the page:

page

Here is my composer.json:

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "require": {
        "php": "^8.1",
        "guzzlehttp/guzzle": "^7.2",
        "imanghafoori/laravel-masterpass": "^2.2",
        "laravel/framework": "^10.10",
        "laravel/sanctum": "^3.2",
        "laravel/tinker": "^2.8",
        "simplesoftwareio/simple-qrcode": "^4.2",
        "spatie/laravel-permission": "^5.10",
        "staudenmeir/eloquent-has-many-deep": "^1.7",
        "symfony/http-client": "^6.3",
        "symfony/mailgun-mailer": "^6.3"
    },
    "require-dev": {
        "fakerphp/faker": "^1.9.1",
        "laravel/pint": "^1.0",
        "laravel/sail": "^1.18",
        "mockery/mockery": "^1.4.4",
        "nunomaduro/collision": "^7.0",
        "phpunit/phpunit": "^10.1",
        "spatie/laravel-ignition": "^2.0"
    },
    "autoload": {
        "psr-4": {
            "App\": "app/",
            "Database\Factories\": "database/factories/",
            "Database\Seeders\": "database/seeders/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\": "tests/"
        }
    },
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\Foundation\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-update-cmd": [
            "@php artisan vendor:publish --tag=laravel-assets --ansi --force"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true,
        "allow-plugins": {
            "pestphp/pest-plugin": true,
            "php-http/discovery": true
        }
    },
    "minimum-stability": "stable",
    "prefer-stable": true
}

Is there something obvious I'm missing here? Thanks for reading

EDIT - to note, I upload the entire site to the hosting. There is no git install, or composer running on the hosting. All files get compiled locally and uploaded to the hosting

0 likes
7 replies
vincent15000's avatar

Have you set the right PHP version ?

Have you written unit tests ?

1 like
ycsm's avatar
Level 1

@vincent15000 Hi Vincent. Yes I tried running with 8.1 and with 8.2. Same issue. I haven't done unit testing, that is a new one on me!

Snapey's avatar

aargh, you have your entire project in public_html?

asking for trouble

2 likes
ycsm's avatar
ycsm
OP
Best Answer
Level 1

As per @snapey - I will upload the files below public_html! I have fixed this though. I am not sure what it was, but I re-uploaded the vendor folder and all is working well.

ycsm's avatar
Level 1

And thank you both for trying to help :)

Please or to participate in this conversation.