Could not open file app/console Symfony 2.8 - php

I am using Symfony 2.8 using Symfony 3 directory structure. After recent composer install it is complaining that
An error occurred when executing the "'cache:clear --no-warmup'" command: Could not open input file: app/console
I looked at the change log and could not find anything regarding this change is there anyway to fix this issue.

Do you have a console folder inside the app one ?
btw try to do php bin/console cache:clear --no-warmup
bin/console is the new directory in Symfony 3. It's maybe the same issue.

Create var directory.
Explanation:
vendor/sensio/distribution-bundle/Composer/ScriptHandler.php:462
protected static function useNewDirectoryStructure(array $options)
{
return isset($options['symfony-var-dir']) && is_dir($options['symfony-var-dir']);
}
So you need both to have symfony-var-dir in composer.json's extra and have this directory existing.

Related

How do I run symfony console?

Everywhere I look in the Symfony documentation for Symfony 4.2, it says that to clear the cache, I run:
php bin/console cache:clear
However, this bin/console is a relative path. I can't find bin/console anywhere. I've done a find on my composer vendor directory. Nothing.
Where is bin/console?
I'm running php 7.2.
Symfony 4.x structures in like this (From CoderSkills)
If you don't have the same after your installation, remove your project folder and create a new ones by running composer create-project symfony/website-skeleton myNewProject
Here is a guide to start a new Symfony project

The Symfone "doctrine:fixtures:load" command missing

I have Symfony 3.1 project with Doctrine and
doctrine/doctrine-fixtures-bundle and
doctrine/data-fixtures installed.
However, when i run a console command
php bin/console doctrine:fixtures:load
i get a message saying that there are no commands defined in the doctrine:fixtures namespace.
The class Doctrine\Bundle\FixturesBundle\Command\LoadDataFixturesDoctrineCommand exists.
Please suggest how to fix that.
Run first php bin/console and see if the command appear in the list.
If it doesn't, then you have to load the bundle in the AppKernel.php
$bundles[] = new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle();
php bin/console default environment is PROD
and fixtures proper installation is require-dev
so proper function call is:
php bin/console --env=dev doctrine:fixtures:load
Also rm -rf var/cache worked for me (after the bundle registration)
Data Fixtures Mechanism requires a special bundle. It is not included in Sf by default.
Check: http://symfony.com/doc/current/bundles/DoctrineFixturesBundle/index.html
and install it.
Bundle called DoctrineFixturesBundle. You can also find there many useful information how to use fixtures.
So that why you've got message "Command is not defined".

Symfony2.7.1 fresh installation. Failed to load resource

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

bin/console missing after running composer install

Hoping someone could help me out with this one please.
My project (on github https://github.com/irvingswiftj/iceMarkt ) when running composer install, seems to run without a hitch, until running the post update commands. In which I end up with the following error (when adding param -vvv):
Updating the "app/config/parameters.yml" file
Could not open input file: bin/console
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.
If I now browse my project directory, I can see that bin/console is never created!
I had deleted the bin directory assuming that the executable console file would be created in my next composer install. I was wrong! Don't gitignore your bin/composer file and also make sure that if you are using the symfony 3 folder structure, you don't have .gitignore for the symfony 2 folder structure.
I had the same problem because I was accostumed to add the bin directory to my .gitignore file, because in Symfony2 all bin files (including the ones from other vendors) where placed in that folder, but that is not the case in Symfony3, so we can add the bin directory to our code repositories.
You can solve problem installing a new application (using the symfony installer) and copying the bin directory from this new project to your own project.
Using Symfony 4 / Symfony Flex, you need to install the symfony/console package:
composer require symfony/console
Then use from your project dir:
./bin/console
As the file itself is starting with a shebang #!/usr/bin/env php you can execute it right away without php infront.
With newer versions of Symfony and Flex installed,
composer --force recipes:install symfony/console
This will bring bin/console into existence.
If it's already there but you need to update it, use
composer recipes:update symfony/console
composer recipes
Just lists your recipes.

Laravel - install Levare modules

Hello how can I create and use modules in laravel ?
I read this: https://github.com/LevareCMS/modulemanager#how-to-use but it doesn't work.
when I put into console: php artisan config:publish app/modules then I see error:
[InvalidArgumentException] Configuration not found.
Everything I created like in above information.
Second question: How can I generate new modules ?
Thanks !
There is an error when publishing config files, change app for levare
php artisan config:publish levare/modules

Categories