Hi everyone,
I'm working on a web project using the Laravel 11 framework, and everything works perfectly fine on my local machine. However, when I try to deploy it on my hosting server, I encounter the following error:
Zend OPcache API is restricted by "restrict_api" configuration directive
My composer.json is :
{
"name": "laravel/laravel",
"type": "project",
"description": "The skeleton application for the Laravel framework.",
"keywords": ["laravel", "framework"],
"license": "MIT",
"require": {
"php": "^8.2",
"barryvdh/laravel-dompdf": "^3.0",
"laravel/framework": "^11.9",
"laravel/tinker": "^2.9",
"livewire/livewire": "^3.4",
"livewire/volt": "^1.0",
"openspout/openspout": "^4.28",
"power-components/livewire-powergrid": "^v6.1.7"
},
"require-dev": {
"fakerphp/faker": "^1.23",
"laravel/breeze": "^2.2",
"laravel/pint": "^1.13",
"laravel/sail": "^1.26",
"mockery/mockery": "^1.6",
"nunomaduro/collision": "^8.0",
"phpunit/phpunit": "^11.0.1"
},
"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",
"@php -r "file_exists('database/database.sqlite') || touch('database/database.sqlite');"",
"@php artisan migrate --graceful --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
}
I’ve tried searching for solutions online, but I’m still unsure about the exact cause of the issue. Could anyone help me understand where this error is coming from?
Additionally, is it possible to disable the OPcache system easily, or is there any specific configuration I should adjust to make the project run on the server as it does locally?
Any help or suggestions would be greatly appreciated!
Thank you in advance!