-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WP-CLI detecting wp-config.php in parent folder could cause command to fail #134
Comments
Have you tried it using many sub-folders, like, for one wordpress app you use public_html/app1 which contains it's own wp-config.php in there, i.e, public_html/app1/wp-config.php and the other app can have a subfolder like public_html/app2 making it public_html/app2/wp-config.php |
@ivanyord I tried to replicate this just now but couldn't. When I tried creating a new config file in a subfolder like you described above, it just created it normally, even though the parent folder already had one (whether that was broken or not). You should check whether you were maybe loading a global config file that was pointing WP-CLI to a specific folder with a WordPress install. |
Hi, I think I'm hitting the same issue. Steps to reproduce: ~ docker run --rm -it php:7.4 /bin/bash
# cd /var/www/html
# curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
# chmod +x wp-cli.phar
# mv wp-cli.phar /usr/local/bin/wp
# touch wp-config.php
# mkdir foo
# cd foo
# wp core download --allow-root
# wp config create --dbname=foo --dbuser=bar --allow-root
Error: The 'wp-config.php' file already exists. If I leave "/var/www/html/foo" empty and create another folder within it the command again works as expected |
This has happened to us today with WP-CLI 2.4.0 |
I think the Also, as a work-around for now, the current check is ignored if you use the |
Hi @ivanyord @schlessera @jkahrs @n3storm @anirudhdggl, I tried to reproduce the issue mentioned, but not able to reproduce it. Here is the approach I used to replicate the same. Approach,
Let me know if I have tested this correct. Also, may be the issue seems to be too old, hence a newer version might have resolved this. Can you please try to replicate this issue with newer version? Here is the Thanks. |
Does wp cli create any hidden files with metadata when executing In my case both wordpress where not downloaded and installed using wp cli. |
Hi, for me the original steps from my listing still reproduce the issue. As a workaround I am currently using |
The case:
Let's say I'm having a WordPress installation which is not working for some reason or WordPress installation leftovers in public_html/. Meanwhile I want to install and configure WordPress in public_html/some-random-subfolder using WP-CLI. I download and place the files in the subfolder, prepare DB and try to
wp config create
The action fails with:
Here is what I have in the wp-config.php in the parent folder:
Additionally, all other WP-CLI commands except wp --info are also failing:
If there's no wp-config.php in the parent dir - it works:
(DB error above is normal, there's no such DB but the point is that I don't receive the wp-config.php related error)
If there is a valid WordPress application with a proper wp-config.php - it works as well.
So, the issue is if there is invalid wp-config/leftovers in the parent directory - this prevents me to configure a new, separate, independent WordPress app using WP-CLI in a sub-folder.
I've tested that on different 2 different stacks - LAMP and LEMP - the behaviour is the same.
Maybe it would be a good idea commands like "config", "core", etc. which could be related to installing and configuring separate application to be independent from the anything else than the files in the current folder?
The text was updated successfully, but these errors were encountered: