Command composer require symfony/apache-pack doesn't create .htaccess file - symfony

When I execute the command:
composer require symfony/apache-pack
It doesn't create an .htaccess file as it is cited in the documentation here.
How can I fix this problem ?

If apache-pack is installed in your project and you later remove the .htaccess file from the /public directory, running composer require apache-pack will not re-install the .htaccess file.
You must first remove apache pack.
So, first run composer remove symfony/apache-pack
And then run composer require symfony/apache-pack
As explained here : https://github.com/symfony/recipes-contrib/issues/676#issuecomment-519959252

The solution is :
1-removing symfony/apach-pack from required in compoer.json
2- run command
composer update
which delete apach-pack from project.
3-run again the command for installing apach-pack as cited in the documentation here:
composer require symfony/apache-pack
4- when asked this question :
Do you want to execute this recipe?
type :
Yes
5- That's it now the file .htaccess exists

I was having the same issue as Dan where composer was not asking me to execute any recipes. it turns out I needed to install Symfony Flex which wasn't present in my microkernel application. I used "composer req symfony/flex" to install it and then afterwards a remove/require of symfony/apache-pack asked me to run the recipe. You can also type "composer recipes" to see your recipes and their status, once flex is installed.

I tried to remove the package and reinstall it but didn't work so I tried to execute the same commands on another console and it works for me
git bash terminal : didn't work
windows terminal: it works (https://learn.microsoft.com/en-us/windows/terminal/)

Related

Best practices composer and Symfony bundle

I starting a bundle with symfony 3.2. It works find in the src directory not in vendor directory. before to go forward. I decided to publish it in packagist/ Github. So i did composer.json and apprently i did something wrong because when i install it the namespace generate an error and if i check in composer autoload nothing about my package. I you have an idea thank for your help.
The pakacge is https://github.com/fabgg/jukeboxBundle
First Download Composer. https://getcomposer.org/download/
Then Open Command Prompt. go to htdocs directory and Run the Command
composer require symfony/finder
Refer : http://symfony.com/doc/current/components/using_components.html

Symfony 2 -> Composer and CloudControl

I have a little problem to setup Symfony 2 on Cloudcontrol,
I followed the instructions and installed a Symfony 2 framework, changed the document root and so on.
Now when I try to push the changes to server server, it loads the dependencies from the composer.json and then it failed with a message :
[RuntimeException]
Could not scan for classes inside "/srv/tmp/builddir/code/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Resources/stubs" which does not appear to be a file nor a folder
This file is a vendor package, loaded from composer.
I have the same effect with a default composer.json file from a sample project (SF2)
Localy it works very well!
Can some one give me a hint ?
Got same error after setting "minimum-stability":"dev" and running composer update.
for unknown reason symfony/symfony (dev-master ...) kept failing to download from source thus was being loaded from cache.
what worked for me was a mix of previous answers:
$ rm -rf vendor/symfony
$ composer clearcache
$ composer install
Sometimes I had to clean composer cache to remove strange errors, usually it's in
/home/user/.composer/cache
You can also try to update composer with
php composer.phar self-update
I hope it runs for you.
I had the exact same error in my development directory.
What fixed it was :
$ rm -rf vendor/symfony
$ php composer.phar install
It reinstalled symfony/symfony, symfony/icu, symfony/assetic-bundle, symfony/monolog-bundle and symfony/swiftmailer-bundle and now everything works !

Symfony2 Composer Install

I am trying to install Symfony 2.1.3 (latest). I am running composer and installs everything okay. The only error that I get is:
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache
handling the post-install-cmd event terminated with an exception
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command.
It's being installed under www folder. I am running nginx and followed the composer approach. I read on internet that apache should be run manually not as a service, however I am using nginx instead. Does apache still have any bearing on it? I'm using debian squeeze.
Edit: As per AdrienBrault's suggestion the error was because the timezone was not set in the php.ini. Only with --verbose I could see the warning. Thanks guys.
Apache is not related - PHP is called via command line.
Most likely is the permission in the cache folder: did you check if the user that runs the composer update can actually write the cache folder?
Try to manually run rm -Rf app/cache/dev (for production environment replace dev with prod) and see if you get any permission error.
Also you will get this error if the default.timezone setting is not configured in php when running in CLI. To verify just run
php --info | grep timezone
and check that the setting date.timezone is correctly configured.
On the security side, setting 777 to the folder is not the optimal solution - if you have ACL enabled you could use that to correctly set up the permission for the cache and logs folder. Read more at the Symfony2 official installation page
I had this same issue for a while and after hours of face to brick wall pounding I realized... I have a .gitmodule in my project, and on initial checkout these submodules are NOT initialized and as such are not there for your composer to update, which results in the above error.
Make sure you run the following
git submodule update --init src/Acme/Sadness/Bundle
of course replace src/Acme/Sadness/Bundle with YOUR project namespace.
Hope this helps someone not go through the same pain I just did.
If you have vendor folder already I would remove it and install symfony 2.1.3 again via "composer.phar install". Problem might be coming from outdated version of composer
I had the same problem and I resolve in this way.
execute this on the console
and you should see something like this
$ locate php.ini
/etc/php5/apache2/php.ini
/etc/php5/cli/php.ini
/etc/php5/fpm/php.ini
the first line is probably your php.ini that appear when you do a phpinfo();
the problem is that when you execute composer update this no check the same php.ini
in my case the second line
all my sites work fine but always I had problems not now
after edit the second file and put the same time zone that you set in the first one
run
$ sudo service apache2 reload
and now
$ composer update
I hope that this work for you like work for me
regards
Emiliano

Composer "chmod(): No such file or directory" with bin directory

I am trying to install my Symfony2 app on koding.com
Trying to install my vendors via php composer.phar update, I run into the following issue, installing doctrine/orm:
Installing doctrine/orm (2.3.x-dev 4d9f24b)
Cloning 4d9f24b2eef3af3a3e76c773994c19bbb0706f88
[ErrorException]
chmod(): No such file or directory
I tried to debug with -v and found out that the following line is causing this issue:
composer.phar/src/Composer/Installer/LibraryInstaller.php:217
In there I see that this issue is related to the bin directory. I have set (S2 default) the bin-dir to "bin". The bin directory is also in place within my project, but somehow composer does not find it, when trying to change the chmod. I have used this setup on several windows machines and also on c9.io.
Issue resolved due to fix on github: https://github.com/composer/composer/issues/1270

Symfony 2.0 bundle installation

So I am a new to doctrine, but I am not able to install a bundle at all. I am following the guide, but the "error" which I am getting is very unusual.
Anyhow, I add this lines into deps file:
[FOSRestBundle]
git=http://github.com/FriendsOfSymfony/FOSRestBundle.git
target=bundles/FOS/RestBundle
Then I do:
./bin/vendors install
And I get:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/sqlite.so' - /usr/lib/php5/20090626+lfs/sqlite.so: cannot open shared object file: No such file or directory in Unknown on line 0
Your project seems to be based on a Standard Edition that includes vendors.
Try to run ./bin/vendors install --reinstall
So on this standard way I am not able to install it at all. Can somebody explain me what is the problem, because to me it looks like, the symfony vendors script doesnt recognize changes in deps file at all.
This happens when you've downloaded the Symfony2 Standard Edition from the website. The vendor install script checks to see if the vendor directories are git repositories, and if not, will throw this error. You can fix the situation in one of two ways:
you can either run the command that it suggests: php bin/vendors install --reinstall
or, you can remove the vendors directory, then run php bin/vendors install, which amounts to about the same thing
No need to install that. Just follow the steps in the url : http://mmoreramerino.github.com/GearmanBundle/installation.html

Resources