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

Devedge's avatar

Multiple Laravel installations - artisan picking up server php version, not the domain php version

Hi folks, wondering if someone can help with an issue I'm having when I have several Laravel systems on a development VPS.

Basically, the server is set up to use php 8.0+ but occassionally we're asked to pull a copy of a live system onto our server to make changes without affecting the live system. Sometimes these systems are not with us/we've not created so we have no control over the PHP version/hosting they're using etc.

In most cases this is fine, however sometimes I need to use php artisan make: . . . but get errors if that specific Laravel system is using an older version of PHP (i.e. v7.4), something like this:

Deprecated: Return type of Illuminate\Container\Container::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool

This prevents me from creating migrations and models etc because I think although the domain is set to run on 7.4 in cPanel, its picking up that the server is running on 8.0+ and refuses to run.

Is there a way I can get artisan to run without changing the server PHP version all the time?

Thanks for any help.

0 likes
3 replies
tomasnorre's avatar
Level 51

Can’t you simply run e.g `/usr/bin/php8.1 artisan´. I would always be specific with php version og multi version servers.

Devedge's avatar

@tomasnorre Thanks for the headsup - I tried this and it worked:

/opt/cpanel/ea-php72/root/bin/php artisan make:… etc

And it generated my model and migrations etc. I then ran it again to migrate the database…

/opt/cpanel/ea-php72/root/bin/php artisan migrate

And have got the following error:

Class 'BeyondCode\DumpServer\DumpServerServiceProvider' not found
in ProviderRepository.php line 208
at ProviderRepository->createProvider('BeyondCode\DumpServer\DumpServerServiceProvider')
in ProviderRepository.php line 144
at ProviderRepository->compileManifest(array('Illuminate\Auth\AuthServiceProvider', 'Illuminate\Broadcasting\BroadcastServiceProvider', 'Illuminate\Bus\BusServiceProvider', 'Illuminate\Cache\CacheServiceProvider', 'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider', 'Illuminate\Cookie\CookieServiceProvider', 'Illuminate\Database\DatabaseServiceProvider', 'Illuminate\Encryption\EncryptionServiceProvider', 'Illuminate\Filesystem\FilesystemServiceProvider', 'Illuminate\Foundation\Providers\FoundationServiceProvider', 'Illuminate\Hashing\HashServiceProvider', 'Illuminate\Mail\MailServiceProvider', 'Illuminate\Notifications\NotificationServiceProvider', 'Illuminate\Pagination\PaginationServiceProvider', 'Illuminate\Pipeline\PipelineServiceProvider', 'Illuminate\Queue\QueueServiceProvider', 'Illuminate\Redis\RedisServiceProvider', 'Illuminate\Auth\Passwords\PasswordResetServiceProvider', 'Illuminate\Session\SessionServiceProvider', 'Illuminate\Translation\TranslationServiceProvider', 'Illuminate\Validation\ValidationServiceProvider', 'Illuminate\View\ViewServiceProvider', 'Barryvdh\DomPDF\ServiceProvider', 'BeyondCode\DumpServer\DumpServerServiceProvider', 'Codescheme\Postcodes\PostcodeServiceProvider', 'Fideloper\Proxy\TrustedProxyServiceProvider', 'HTMLMin\HTMLMin\HTMLMinServiceProvider', 'Intervention\Image\ImageServiceProvider', 'JeroenNoten\LaravelAdminLte\ServiceProvider', 'Illuminate\Notifications\NexmoChannelServiceProvider', 'Illuminate\Notifications\SlackChannelServiceProvider', 'Laravel\Tinker\TinkerServiceProvider', 'Carbon\Laravel\ServiceProvider', 'NunoMaduro\Collision\Adapters\Laravel\CollisionServiceProvider', 'LaravelPWA\Providers\LaravelPWAServiceProvider', 'Spatie\DirectoryCleanup\DirectoryCleanupServiceProvider', 'Spatie\Permission\PermissionServiceProvider', 'UxWeb\SweetAlert\SweetAlertServiceProvider', 'JeroenNoten\LaravelAdminLte\ServiceProvider', 'Barryvdh\DomPDF\ServiceProvider', 'Intervention\Image\ImageServiceProvider', 'Codescheme\Postcodes\PostcodeServiceProvider', 'App\Providers\AppServiceProvider', 'App\Providers\AuthServiceProvider', 'App\Providers\EventServiceProvider', 'App\Providers\RouteServiceProvider'))
in ProviderRepository.php line 61

etc

This appears to be a Laravel 5.7 version and its now not possible to access the system (its on our dev server so I can always replace it) but I've not come across this error before.

Any ideas how to rectify it?

Devedge's avatar

I ran composer update --ignore-platform-reqs and that seems to have solved the problem so far.

2 likes

Please or to participate in this conversation.