2
votes

I am trying to deploy my symphony application on a shared hosting but I keep getting error 500.

I structured the app, bin, src and vendor on the parent folder then I changed the web folder to public_html on cpanel.

when I run the URL using example.com/app_dev.php it works fine.

However when use example.com i get error 500, so I toggled the PHP option on cpanel to display_error and this is the error I am getting:

Warning: include_once(/home/kaftenh1/public_html/../var/bootstrap.php.cache): failed to open stream: No such file or directory in /home/kaftenh1/public_html/app.php on line 7

Warning: include_once(): Failed opening '/home/kaftenh1/public_html/../var/bootstrap.php.cache' for inclusion (include_path='.:/opt/alt/php70/usr/share/pear') in /home/kaftenh1/public_html/app.php on line 7

Fatal error: Uncaught Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: The service "elao.error_notifier.listener" has a dependency on a non-existent service "swiftmailer.mailer.notifier". in /home/kaftenh1/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php:58 Stack trace: #0 /home/kaftenh1/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php(42): Symfony\Component\DependencyInjection\Compiler\CheckExceptionOnInvalidReferenceBehaviorPass->processReferences(Array) #1 /home/kaftenh1/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php(36): Symfony\Component\DependencyInjection\Compiler\CheckExceptionOnInvalidReferenceBehaviorPass->processDefinition(Object(Symfony\Component\DependencyInjection\Definition)) #2 /home/kaftenh1/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compi in /home/kaftenh1/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php on line 58

Thanks for

3
Does the file at /home/kaftenh1/var/bootstrap.php.cache exist? Note the .. in the path goes upa level, removing public_html from the pathMilk
you can try to chmod 777 for var directory.Mehmet Soylu
@Milk thanks alot it worked changed the pathSuleiman Sani

3 Answers

1
votes

Try run command:

composer install

Or

php composer.phar install

I hope this video tutorial help you. https://www.youtube.com/watch?v=HchMW8EhWPU

0
votes

Thanks everyone. Really appreciate. From your answer and comments i figured the what the problem was. I changed the path in app.php to point where the bootstrap.php.cache is.

<?php

use Symfony\Component\HttpFoundation\Request;

/** @var \Composer\Autoload\ClassLoader $loader */
 $loader = require __DIR__.'/../app/autoload.php';
include_once '/home/kaftenh1/var/bootstrap.php.cache';  
-1
votes

If you have ssh access to the server you can then login to the server and open the website project and run

 composer install

If you dont have ssh access try to use webconsole .