vichuploader cannot update file in production - symfony

I'm using vichuploader for storing avatars. Eveyrhing is working fine on my local server but during file update in production server throw such error:
request.CRITICAL: Uncaught PHP Exception Symfony\Component\HttpFoundation\File\Exception\FileException: "Unable to create the "kernel.root_dir/../image/avatar/4" directory" at /home/xxx/xxxx.com/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/File.php line 110 {"exception":"[object] (Symfony\\Component\\HttpFoundation\\File\\Exception\\FileException(code: 0): Unable to create the \"kernel.root_dir/../image/avatar/4\" directory at /home/xxx/xxx.com/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/File.php:110)"} []
I use symfony 3 on OVH shared hosting, does anyone have idea what is wrong?

You have not permission to create files in directory /image/avatar

Related

How to fix 'Uncaught PHP Exception Twig_Error_Loader: Unable to find template' on Symfony 3.4?

I deployed a symfony 3.4 project from my local machine (Windows 10) to a cloud server (Digital Ocean) based on Ubuntu.
I spent 2 days trying to resolve this (i think) routing problem:
"request.CRITICAL: Uncaught PHP Exception Twig_Error_Loader..."
Locally, on localhost with XAMPP, it works perfect.
The project runs ok on the login (is like a backend user app), with the register ok But when it tries to pass the login, it needs to load the initial dashboard with some includes (like nav_side.html.twig) and the server response is error 500.
How can i fix it?
Thanks a lot for your response...i'm a little bit desperate. :)
I made composer update, i deleted the cache folder, but the error is still there.
request.CRITICAL: Uncaught PHP Exception Twig_Error_Loader: "Unable to
find template "Backe ndBundle:includes:nav_side.html.twig"
(looked into: /var/www/onecup/app/Resources/views,
/var/www/onecup/vendor/s
ymfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form) in
"BackendBundle:Dashboard:index.html.twig" at line 7." at
/var/www/onecup/vendor/twig/twig/lib/Twig/Loader/Filesystem.php line
234 {"exception":"[object] (Twig_Err or_Loader(code: 0):
Unable to find template \"BackendBundle:includes:nav_side.html.twig\"
(looked into: /var/www/ onecup/app/Resources/views,
/var/www/onecup/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form)
in \"BackendBundle:Dashboard:index.html.twig\" at line 7. at
/var/www/onecup/vendor/twig/twig/lib/Twig/Loader/Fil
esystem.php:234)"} []
#Flying was right: examine your code and try to find possible case inconsistences in directory / filenames. e.g. "file" and "File". Windows filesystem is case-insensitive, but Ubuntu filesystem is case-sensitive.
So, i changed the Includes to includes and that's all.
Thanks a lot!! :)

Error when trying to acces website url during deployment Sympfony2

I'm deploying Symfony2 for the first time on a shared hosting.
I get different errors:
FIrst one when I try to acces the website by its normal url:
Fatal error: Uncaught exception 'UnexpectedValueException' with message 'The stream or file "C:/wamp/www/SocProNetbeans/app/logs/prod.log" could not be opened: fopen(C:/wamp/www/SocProNetbeans/app/logs/prod.log) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory' in /home/stijnxk59/domains/stijnxk59.fiftynine.axc.nl/app/cache/prod/classes.php:4987 Stack trace: #0 /home/stijnxk59/domains/stijnxk59.fiftynine.axc.nl/app/cache/prod/classes.php(4931): Monolog\Handler\StreamHandler->write(Array) #1 /home/stijnxk59/domains/stijnxk59.fiftynine.axc.nl/app/cache/prod/classes.php(4856): Monolog\Handler\AbstractProcessingHandler->handle(Array) #2 /home/stijnxk59/domains/stijnxk59.fiftynine.axc.nl/app/cache/prod/classes.php(5056): Monolog\Handler\AbstractHandler->handleBatch(Array) #3 /home/stijnxk59/domains/stijnxk59.fiftynine.axc.nl/app/cache/prod/classes.php(5361): Monolog\Handler\FingersCrossedHandler->handle(Array) #4 /home/stijnxk59/domains/stijnxk59.fiftynine.axc.nl/app/cache/prod/cl in /home/stijnxk59/domains/stijnxk59.fiftynine.axc.nl/app/cache/prod/classes.php on line 4987
Second one is that I don't receive some background images in development mode
You need to give write permissions for the two following folders :
app/logs
app/cache
Have a look at symfony configuration and setup doc.

Symfony production environment throws 500 error: Doctrine\ORM\ORMException 'Unknown Entity namespace alias 'DSBlogBundle'

I'm learning Symfony2, really cool stuff. But I do run into some trouble when I want to try and visit the production environment. I have followed the Symblog Tutorial that is located here: http://tutorial.symblog.co.uk/
I have cleared the cache and I visit http://symfony.dev/ I have running locally. The page remains totally blank and this error is in the log:
Fatal error: Uncaught exception 'Doctrine\ORM\ORMException' with message 'Unknown Entity namespace alias 'DSBlogBundle'.'
in /Applications/MAMP/htdocs/symfony/vendor/doctrine/orm/lib/Doctrine/ORM/ORMException.php:236
Stack trace:
#0 /Applications/MAMP/htdocs/symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Configuration.php(194): Doctrine\ORM\ORMException::unknownEntityNamespace('DSBlogBundle')
#1 /Applications/MAMP/htdocs/symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php(554): Doctrine\ORM\Configuration->getEntityNamespace('DSBlogBundle')
#2 /Applications/MAMP/htdocs/symfony/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php(194): Doctrine\ORM\Mapping\ClassMetadataFactory->getFqcnFromAlias('DSBlogBundle', 'Blog')
#3 /Applications/MAMP/htdocs/symfony/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php(295): Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->getMetadataFor('DSBlogBundle:Bl...')
#4 /Applications/MAMP/htdocs/symfony/vendor in /Applications/MAMP/htdocs/symfony/vendor/doctrine/orm/lib/Doctrine/ORM/ORMException.php on line 236
What I don't get is that the 'Unknown Entity namespace alias 'DSBlogBundle' is perfectly "known" in the development environment. Does anyone know what I am missing? Any help is much appreciated! Thank you!
Couple possibilities I can think of:
1) If your code functions properly in the development environment, then it could be a cache problem and/or a permissions problem. Make sure your files are readable by the user/process associated with your web server and make sure the prod cache directory is writable by that user so it can generate the necessary files. What I generally do is run the clear cache console command AS that user to avoid unexpected cache problems, like this (on linux):
sudo -u www-user php app/console cache:clear --env=prod
If you're developing on linux, you must be logged in as either root or another user with administrator privileges to run a command as a user other than yourself.
2) You may have configurations defined in the dev environment that don't exist in the prod environment. Double check the files in your app/config folder. My first guess would have been that the DSBlogBundle wasn't correctly defined in app/AppKernel.php but I believe that's environment independent so it couldn't work in dev but not prod.

Symfony2 Permission Denied error while creating a bundle

First of all, I want to say I might be missing something basic, but I'm actually new in Symfony.
While I'm creating a bundle from terminal(I'm using mac), it gives me that error;
[UnexpectedValueException]
The stream or file "/Applications/MAMP/htdocs/Symfony/app/logs/dev.log" cou
ld not be opened: failed to open stream: Permission denied
Here is the code for creating a bundle
php app/console generate:bundle --namespace=Ens/JobeetBundle --format=yml
I believe that your permissions were not set correctly. Here is how to set it up - http://symfony.com/doc/current/book/installation.html#configuration-and-setup

symfony2 load fixtures gives error, please advise on how to fix?

i am on part Updating the blog entity where i need to load the fixtures with command:
$ php app/console doctrine:fixtures:load
but i get an error:
php app/console doctrine:fixtures:load
> purging database
> loading Blogger\BlogBundle\DataFixtures\ORM\BlogFixtures
> loading Blogger\BlogBundle\DataFixtures\ORM\CommentFixtures
[ErrorException]
Warning: file_put_contents(/home/helloises/symfony2/Symfony/app/cache/dev/doctrine/orm/Proxies/Blogge rBlogBundleEntityBlogProxy.php): failed to open stream: Permission denied in
/home/helloises/symfony2/Symfony/vendor/doctrine/lib/Doctrine/ORM/Proxy/ProxyFactory.php
line 155
please help?
thanks
This is a permission error:
You don't have the write permission in the app/cache/dev/doctrine/orm/Proxies directory of your project so doctrine fails to create its proxy classes.
Maybe you gave the write permission to your HTTP server user (so the web works) but not to the user you used to execute the command.
See the Setting up Permissions paragraph in http://symfony.com/doc/current/book/installation.html#configuration-and-setup

Resources