I have a huge problem with Symfony. I installed Symfony 2.7.5 from command line:
$ symfony new my_project
But the main problem is that all project was generated correctly with the exception of directory: /web/bundle
So I have in this folder two empty files (not catalogues!) with 0 KB size: framework and sensiodistribution. That means all Symfony error pages haven't any css style and look ugly.
Screens:
My local folder:
and
Error page:
What should I do?
Command:
$ app/console assets:install
populated this catalogue and it was the solution of the problem.
Related
I created one project in symfony 2 I send it to my company but the project not working properly no fils css, no file js no pictures.
I'need my my laptop it works correctly.
So i connected remotly to my company
I excuted this command
php app/console assetic:dump
but I have this problem
There are no commands defined in the "assetic" namespace.
Did you mean this?
assets
I don't know why I have this problem with this command. But
php app/console assets:install it works correctly
Thanks stack overflow
In the documentation is written that be used with:
php app/console assetic:dump --env=prod --no-debug
maybe the directory seperator like \ and no /
https://symfony.com/doc/2.8/assetic/asset_management.html#dumping-asset-files-in-the-prod-environment
this command belongs to this bundle
https://github.com/symfony/assetic-bundle
I think above bundle is not installed.
check your composer.json or vendor folder.
Symfony2 developers:
Recently, I am planning to get familiar with Symfony2, using it as api project. Current version is v2.7.1.
I already have apache installed as my local environment. So the installation root directory is:
//localhost/symfony
So I followed official guide to install it. Everything looks fine after installation. But when I view the page in development environment (app_dev.php).
//localhost/symfony/web/app_dev.php
Page content display as expected, but not styled. Then I open console and find some 404 response as follows:
Failed to load resource
//localhost/symfony/web/bundles/framework/css/structure.css
//localhost/symfony/web/bundles/framework/css/body.css
//localhost/symfony/web/bundles/framework/css/exception.css
//localhost/symfony/web/app_dev.php
//localhost/symfony/web/bundles/framework/css/structure.css
//localhost/symfony/web/bundles/framework/css/body.css
//localhost/symfony/web/bundles/framework/css/exception.css
I looked into project/web/bundles directory, found nothing inside but two empty file.
framework and sensiodistribution.
Fresh installation without any config change. I got this problem. Could you guys give some explanation why it occurs. Otherwise I didn't get the full package?
Do I miss those files inside project/web/bundles?
If the case in which i missed those file. So could you send me an archive file on current version 2.7.1?
You must run the command app/console assets:install to generate symlinks (or files) in /web/bundles
If these files exists then you probably have problem with URL Rewriting check your .htaccess or configure your host. You can also use command php app/console server:start and check there if it works
You can run composer install to install all necessary bundles and libraries and probably composer.json has defined postinstall commands.
If you use assetic then you can try to run php app/console assetic:dump more on http://symfony.com/doc/current/cookbook/assetic/asset_management.html
In Symfony 2.6 you have new asset manager read more on http://symfony.com/blog/new-in-symfony-2-6-smarter-assets-install-command
php app/console assets:install or php app/console assets:install --symlink
for Symfony 3.x the directory changed from app to bin so commands are:
php bin/console assets:install or php bin/console assets:install --symlink
Since I landed here from a Symfony 3 search this might be useful for Symfony 3 users having the same problem
Run php bin/console assets:install at the project root
I am trying to sync my Symfony2 project with Travis CI. I followed all the instructions and managed to set everything up correctly. My final hurdle is .travis.yml file which i have added under the root directory of Symfony project.
Content of my .travis.yml file:
php:
- 5.4
script:
- ./binphpunit -c app
notifications:
email:
- myemail#gmail.com
My phpunit is installed under bin/phpunit as binary
Error log:
/usr/bin/env: php No such file or directory
The command "./bin/phpunit -c app" exited with 127
Probably you miss the language specification. Try putting this:
language: php
as first line.
Double check the phpunit travis configuration, probably simply without any path.
Check an example here
Hope this help
I have a problem with Symfony assets on heroku (official php buildpack).
My code is based on Symfony 2.5 with new 3.0 folder structure, and it's using one local js and css file (the rest is loaded via cdn).
Those files are loaded exactly as described here: http://symfony.com/doc/current/cookbook/assetic/asset_management.html.
On dev environment everything is ok, but when i change env to prod then i need to do assetic:dump to force symfony dump my assets files into web/css|js folders. I made test on my local machine (switching env to prod) and everything is ok. The problem is with heroku, and its ephemeral filesystem:
When I try to run assetic:dump --env=prod by composer post-install-cmd, then deploy finish with successs, but every request ends up with:
AH01071: Got error 'PHP message: PHP Fatal error: Uncaught exception
'InvalidArgumentException' with message
'The file "/tmp/build_012d99e7-a14a-4626-afec-3ded3d4baeec/app/config/routing.yml"
When i deploy app without assetic:dump then of course my local css and js files are not available :/
Maybe there is some other script hook i can use to dump my assets?
Any ideas? Anyone succeded with assetic:dump on heroku and official php buildpack?
PHP and Symfony support has been revamped a lot in the last months, check out these links:
http://symfony.com/doc/current/cookbook/deployment/heroku.html
https://devcenter.heroku.com/articles/getting-started-with-php
https://devcenter.heroku.com/articles/php-support
https://devcenter.heroku.com/articles/getting-started-with-symfony2
What's most important:
Set an environment variable for SYMFONY_ENV
The value of SYMFONY_ENV is used to define the environment for CLI commands. So you don't have to fiddle about something like --env=prod in you custom commands. Composer hooks from composer.json (like post-install-cmd) are automatically executed with the defined environment. Please note: Set it to something different than dev. A dev environment may not work well on Heroku because Composer's dev dependencies (require-dev) are not installed. This is due to the --no-dev flag during the composer install on Heroku. For example, in the Symfony Standard Edition) the SensioGeneratorBundle never gets installed (if you do not move it to the require key in composer.json) and the dev environment won't work.
Error on /tmp path
The mentioned error should have been fixed with https://github.com/symfony/symfony/pull/12784. See also https://github.com/heroku/heroku-buildpack-php/issues/64.
Custom commands during deployment
Custom commands like assetic:dump can be placed in composer.json's script section under the compile key:
{
"scripts": {
"compile": [
"app/console assetic:dump"
]
}
}
See also https://devcenter.heroku.com/articles/php-support#custom-compile-step. Environment is taken from the above mentioned SYMFONY_ENV environment variable.
I have installed Symfony2 on a iis 7 server with PHP 5.3.21 and everything works ok ( the php, the symphony demo page ).
I try to create my own helloWorld, as the tutorial says :
php app/console generate:bundle
I go Start->Run->CMD and put that line of code and it gives me back this :
could not open input file : app/console
and before anyone asks i am in the project directory when i perform this command
I put the PHP directory to the System PATH but the problem persists.
Update: I ended up getting on a screen sharing program with #reza and discovered he had accidentally set his PATH variable to D:\php\wamp\bin\php\php5.3.10\php.exe rather than D:\php\wamp\bin\php\php5.3.10. Fixing this solved the problem.
Check this: I can't create bundle in symfony2
For newer versions of Symfony (2.4.x or newer) use this method on windows to resolve the problem:
Go to project directory e.g. d:/xampp/symfony2-project/ and open composer.json and place this under requires array "symfony/console": "2.4.*#dev". And save the file.
Open command-line and cd to project's directory.
Use this command to let download and install the dependencies: php path/to/composer.phar install. Remember you should be in your project's directory and path/to/composer.phar is the actual path to your composer.phar file.
Now you are all done, just use php bin/console generate:bundle --namespace=Test/PrintBundle --format=yml to test bundle system works.
If you are creating Symfony 2.5 project using command prompt then console file is not storing the app folder but it storing in the bin folder so you need to use bin folder instead of app folder (CODE is : php bin/console generate:bundle).