Chapters
30 Chapters
|
2:45:48
|
Login to bookmark this video
-
Course Code
Subscribe to download the code!Compatible PHP versions: >=5.5.9
Subscribe to download the code!Compatible PHP versions: >=5.5.9
-
This Video
Subscribe to download the video!
Subscribe to download the video!
-
Subtitles
Subscribe to download the subtitles!
Subscribe to download the subtitles!
-
Course Script
Subscribe to download the script!
Subscribe to download the script!
29.
Host Group Vars
Scroll down to the script below, click on any sentence (including terminal blocks) to jump to that spot in the video!
Subscribe to jump to this part in the video!
Keep on Learning!
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
This tutorial is built using an older version of Symfony, but the core concepts of Ansible are still valid. New versions of Ansible may contain some features that we don't use here.
What PHP libraries does this tutorial use?
// composer.json
{
"require": {
"php": ">=5.5.9",
"symfony/symfony": "3.1.*", // v3.1.4
"doctrine/orm": "^2.5", // v2.7.2
"doctrine/doctrine-bundle": "^1.6", // 1.6.4
"doctrine/doctrine-cache-bundle": "^1.2", // 1.3.0
"symfony/swiftmailer-bundle": "^2.3", // v2.3.11
"symfony/monolog-bundle": "^2.8", // 2.11.1
"symfony/polyfill-apcu": "^1.0", // v1.2.0
"sensio/distribution-bundle": "^5.0", // v5.0.12
"sensio/framework-extra-bundle": "^3.0.2", // v3.0.16
"incenteev/composer-parameter-handler": "^2.0", // v2.1.2
"doctrine/doctrine-migrations-bundle": "^1.2", // v1.2.0
"snc/redis-bundle": "^2.0", // 2.0.0
"predis/predis": "^1.1", // v1.1.1
"composer/package-versions-deprecated": "^1.11" // 1.11.99
},
"require-dev": {
"sensio/generator-bundle": "^3.0", // v3.0.8
"symfony/phpunit-bridge": "^3.0", // v3.1.4
"doctrine/data-fixtures": "^1.1", // 1.3.3
"hautelook/alice-bundle": "^1.3" // v1.4.1
}
}
11 Comments
Hi,
I have been following this tutorial with great success until now.
I keep getting 500 error from the server running on aws but the logs show nothing.
Anything I missed here?
Hey Ronaldo,
Do you mean Symfony logs show nothing? If so, then the problem might be with write permissions to var/ directory, you can try to make them 777 for debugging and try again, then check logs to see something there. Or btw, it might be an issue on server level, that means you see the 500 error from your Nginx/Apache web server, and so try to check logs of Nginx/Apache instead. If the problem on web server level - you will see nothing in Symfony logs.
I hope this helps!
Cheers!
I am not a symfony user, only using it during this tutorial, don't know where to find its logs.
The logs I have been looking into are the nginx ones, which are empty.
A request to mootube.ec2 return 500 and there is nothing about the error in any of the logs I can find.
I just tried changing the permission on the var folder and subfolder but no luck
Hey Ronaldo,
If you look at Nginx logs and find nothing there - then most probably the problem in the application. To find Symfony logs - go to "var/log/" or "var/logs/" depends on your Symfony version, and look for prod.log there. Or, basically, when you're in a root folder you can tail logs with the next command:
$ tail -f var/log/prod.log
Cheers!
I have no prod.log file at all.
I have already looked around for other log files that could give me a clue as for what is wrong but nothing seems to be logged
Hey Ronaldo,
Hm, it should be something either in Nginx logs or in Symfony application logs. At least, in Nginx you should be able to see that Nginx was handled your request. IIRC the log file is called access.log in Nginx. If you even don't see any logs there - probably your web server is configured wrong, but it would mean you won't see 500 error. So, if you see 500 error - most probably Nginx is able to response to your requests. I'd recommend you to try to do a crazy thing and set 777 permissions for the entire project for debugging purposes. But first, try to clear and warmup the cache, i.e. inside your project:
$ bin/console cache:clear
$ bin/console cache:warmup
$ chmod -R 777 .
And then try to access the website again in a browser.
Cheers!
Nginx is responding and it is logging the access in access.log, that is the only log I have
I get this when I try to clear the cache
PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "SensioGeneratorBundle" from namespace "Sensio\Bundle\GeneratorBundle".<br />Did you forget a "use" statement for another namespace? in /var/www/project/app/AppKernel.php:28<br />Stack trace:<br />#0 /var/www/project/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(396): AppKernel->registerBundles()<br />#1 /var/www/project/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(114): Symfony\Component\HttpKernel\Kernel->initializeBundles()<br />#2 /var/www/project/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php(68): Symfony\Component\HttpKernel\Kernel->boot()<br />#3 /var/www/project/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php(117): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))<br />#4 /var/www/project/bin/console(29): Symfony\Component\Console\Appli in /var/www/project/app/AppKernel.php on line 28Hey Ronaldo,
Ah, yes, you need to clear the cache in prod environment because SensioGeneratorBundle is installed in dev env only. So, try to clear the cache with:
$ bin/console cache:clear --env=prod
$ bin/console cache:warmup --env=prod
It should be executed without errors. Then change permissions to 777.
Cheers!
Ok, I figured what was wrong.
It turns out I was looking for symfony logs in the wrong log folder, there is a var/logs in the project folder that I missed completely.
The prod.log gave me a clue as for where to look and the problem was that for some reason my database was created but it was completely empty, no tables.
One other problem I ran into, which I fixed manually, was that the ansible setup has problems login into mysql with no password which I manage to bypass just by adding skip-grant-tables in the mysql conf but this should definitely not be there.
All working now.
Hey Ronaldo,
Yeah, depends on Symfony versions logs might be in var/log/ or var/logs/ directory, glad your solved your problems. And thanks for your feedback about what exactly was wrong, it may help other users.
Cheers!
"Houston: no signs of life"
Start the conversation!