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

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

Related

Symfony 4 - php bin/console server:run not works

I have a problem with this command : php bin/console server:run on Symfony 4
When I go to http://127.0.0.1:8000/ I have this error message :
Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
Fatal error: Unknown: Failed opening required 'J:\my_project\vendor\symfony\web-server-bundle/Resources/router.php' (include_path='.;C:\php\pear') in Unknown on line 0
Indeed, the router.php file does not exist !
But if I run this command : php -S 127.0.0.1:8000 -t public everything is ok.
Any idea ?
First check that you have installed the SF4 Web Server bundle :
> composer require server --dev
then you can start using it through Symfony using run / start command
Not sure if this is the case for you too, but it is probably worth checking (and may also be interesting for others having the same problem).
My antivirus software likes to put the router.php in quarantine (effectively removing it from that directory). Check if yours did the same and if so restore it and create an exception for that file. Additionally you should configure your antivirus to notify you if it puts something in quarantine, so you can intervene in time.

error when I try to open app_dev.php file

I install symfony 2 under htdocs(xampp) folder, I start apache then I try to open app_dev.php file using this url :
http://localhost/symfony2/web/app_dev.php
I get this error :
Warning: require(C:\xampp\htdocs\symfony2\app/../vendor/autoload.php):
failed to open stream: No such file or directory in
C:\xampp\htdocs\symfony2\app\autoload.php on line 9
Fatal error: require(): Failed opening required
'C:\xampp\htdocs\symfony2\app/../vendor/autoload.php'
(include_path='C:\xampp\php\PEAR') in
C:\xampp\htdocs\symfony2\app\autoload.php on line 9
the tutorial that I follow (here) say that it will open a page
I reistall symfony using this command :
$ composer create-project symfony/framework-standard-edition my_project_name "2.7.*"
it works perfectly
Best way is to start symfony via the console to get the development enviroment:
bin/console server:run
http://symfony.com/doc/current/book/installation.html#running-the-symfony-application
Also check the read and write privileges, and check the composer installation.

Bootstrap 3 in Symfony2

I'm trying to use bootstrap in my symfony project . But when I configure json file through this error. However I have included
new Braincrafted\Bundle\BootstrapBundle\BraincraftedBootstrapBundle()
I have looked up from here
error:
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-update-cmd event terminated with an exception
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command:
PHP Fatal error: Class 'Braincrafted\Bundle\BootstrapBundle\BraincraftedBo
otstrapBundle' not found in /home/kanat/Public/bootstrap/app/AppKernel.php
I have looked up from here
like the error says, its having touble clearing the cache, that could be a directory permission issue,set the folder permissions to read write and execute and then try to clear cache again, (in linux it would be sudo chmod -R 777 *)

Symfony2 Bootstrap.php.cache

I'm developing in Ubuntu 14 and I get the following error when creating a databaes:
$ php app/console doctrine:database:create
This is the error output:
PHP Warning: require_once(/home/jesse/playground/www/symfony/htdocs/app/bootstrap.php.cache):
failed to open stream: No such file or directory in
/home/jesse/playground/www/symfony/htdocs/app/console on line 10
PHP Fatal error: require_once(): Failed opening required
'/home/jesse/playground/www/symfony/htdocs/app/bootstrap.php.cache'
(include_path='.:/usr/share/php:/usr/share/pear') in
/home/jesse/playground/www/symfony/htdocs/app/console on line 10
What Ive Tried
Running this in Vagrant
Running this Locally
This is one among several problem running Symfony2 under Ubuntu, the other forcing you to implement umask(0000) otherwise you have to get chmod +a permissions for log and cache folders, this seems like a bit of a hassle for something seemingly simple.
Does anyone know what to work around this error?
This should do the trick:
php /home/jesse/playground/www/symfony/htdocs/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php

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

Resources