Ervin
Ervin

Reputation: 2452

You have requested a non-existent service "phpexcel"

I know there are some questions almost identical but none of them seems to be my case.

I have a symfony 2.8.3 project that reads and imports data from an excel file into mysql database. Its all working nice on localhost but in the last 48 hours I've been trying to get it working on my server. Its a shared hosting, with no SSH access to the linux.

When I am trying to load it from the server I get this error: "You have requested a non-existent service "phpexcel"."

Upvotes: 2

Views: 1478

Answers (2)

Paweł Mikołajczuk
Paweł Mikołajczuk

Reputation: 3812

Looks like you want to use service from ExcelBundle. But that bundle is not loaded. Check if you have it added for production env.

$bundles = array(
    // ...
    new Liuggio\ExcelBundle\LiuggioExcelBundle(),
);

Don't forget to clear cache on production environment after any config (AppKernel.php also) change.

To clear cache run php app/console cache:clear. You can also add env parameter: --env=dev or --env=prod - depending on your env. If it don't help then just remove all content of app/cache/ directory (or var/cache/ in case of Symfony3 app)

Upvotes: 4

Ervin
Ervin

Reputation: 2452

Pawel answered correctly, but something is missing: after you add this line: new Liuggio\ExcelBundle\LiuggioExcelBundle(), to the AppKernel.php file, inside the $bundles array, don't forget to clear the cache: delete the file from app/cache/dev in case you're in developer mode or app/cache/prod in case on production mode.

Upvotes: 1

Related Questions