0

I have deployed a Symfony2 application to shared hosting server from local machine. I used a git pull followed by composer install and then i chmoded the app/cache and app/logs permissions to 777.

Each time I run the application I get the following error:

[2016-02-06 18:55:43] request.CRITICAL:
Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalErrorException:
"Compile Error: require(): Failed opening required 'vendor/autoload.php'
(include_path='.:/opt/alt/php55/usr/share/pear:/opt/alt/php55/usr/share/php')" at
/home/tdarlic/public_html/magniblu/users/src/AppBundle/Controller/DefaultController.php line 5 {"exception":"[object]
(Symfony\Component\Debug\Exception\FatalErrorException(code: 0): Compile
Error: require(): Failed opening required 'vendor/autoload.php'
(include_path='.:/opt/alt/php55/usr/share/pear:/opt/alt/php55/usr/share/php') at /home/tdarlic/public_html/magniblu/users/src/AppBundle/Controller/DefaultControll er.php:5)"} []

I managed to fix this by entering full path to autoload.php:

require '/home/tdarlic/public_html/magniblu/users/vendor/autoload.php';

I tried with

../../../vendor/autoload.php

and with

../../vendor/autoload.php
require __DIR__.'../../vendor.autoload.php';

and still cannot figure out how to keep the autoload file link loading correctly on development machine and on the server. Any ideas how to solve this?

Similar issue can be found on: Why my autoload.php of composer doesn't work?

Community
  • 1
  • 1
  • You have to execute `php composer.phar update` ... When you move folders or install the project on another device, the vendor autoload.php doesn't exist or the path is absolute (so wrong path if you move the folder) – Pierre Emmanuel Lallemant Feb 06 '16 at 21:43
  • Why do you require an autoload from the controller at very first place? – zerkms Feb 06 '16 at 21:52
  • Thanks for the idea. The code was copied by another developer so I thought there was a reason. After your post I've checked the rest of the class, removed autoloader and it works. I lost 3 hours on this..... – Tomislav Darlic Feb 06 '16 at 22:01

0 Answers0