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

5

6

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 ?

Duvalier answered 14/6, 2019 at 8:52 Comment(4)
For avoidance of doubt, could you add a link to the documentation you are looking at?Lichee
The exact output you get when running the command would also help - if I run it I end up with an .htaccess file in the `public` dir.Lichee
I added the link to the documentation .Duvalier
when I run the command it seems working but when I search in my project I dont find the htaccess file.Duvalier
D
10

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

Diminutive answered 11/10, 2019 at 15:42 Comment(2)
If you are not asked to run the recipe, check you have symfony/flex installed as well. If not, try adding it with "composer req symfony/flex" then try the remove / require again.Annabellannabella
I had to run those commands twice to make it workPilcher
D
2

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

Duvalier answered 14/6, 2019 at 10:10 Comment(1)
What if symfony/apache-pack doesn't ask you if you want execute a recipe?Mielke
A
1

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.

Annabellannabella answered 5/12, 2021 at 22:6 Comment(0)
S
0

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

Sear answered 31/7, 2022 at 14:10 Comment(0)
F
0

Just force apply the recipe :

$ composer sync-recipes --force symfony/apache-pack
Foresail answered 7/5 at 14:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.