Skip to content
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

Infinite loop... Error: 'wp-config.php' not found. Infinite loop... #149

Open
2 tasks done
ghost opened this issue Dec 9, 2022 · 3 comments
Open
2 tasks done

Infinite loop... Error: 'wp-config.php' not found. Infinite loop... #149

ghost opened this issue Dec 9, 2022 · 3 comments

Comments

@ghost
Copy link

ghost commented Dec 9, 2022

Bug Report

Describe the current, buggy behavior

I have written a bash script to quickly install and setup wordpress on my AlmaLinux 8.7 server.

When the mysql command is missing (by accident or by choice, when the DB is remote and not local), then executing wp-cli causes it to enter an infinite loop! I managed to replicate the same infinite loop even if the mysql is installed, but the remote DB can't be accessed due to authentication error.

Here is how I call wp-cli from my bash script:

wp config create					\
	--path="${WPPATH}"				\
	--locale="${WPLOCALE}"				\
	--dbname="${WPDBNAME}"				\
	--dbhost="${WPDBHOST}"				\
	--dbcharset=utf8mb4				\
	--dbcollate=utf8mb4_unicode_ci			\
	--dbuser="${WPDBUSER}"				\
	--dbpass="${WPDBPASS}"				\
	--extra-php <<PHP

${STAGEVARS}

PHP

The console output looks like:

$ ./install-script.sh 
Downloading WordPress 6.1.1 (en)...
Using cached file '/home/user/.wp-cli/cache/core/wordpress-6.1.1.tar.gz'...
Success: WordPress downloaded.
/usr/bin/env: ‘mysql’: No such file or directory
Error: 'wp-config.php' not found.
Either create one manually or use `wp config create`.
Error: 'wp-config.php' not found.
Either create one manually or use `wp config create`.
Error: 'wp-config.php' not found.
Either create one manually or use `wp config create`.
Error: 'wp-config.php' not found.
Either create one manually or use `wp config create`.
Error: 'wp-config.php' not found.
Either create one manually or use `wp config create`.
Error: 'wp-config.php' not found.
Either create one manually or use `wp config create`.
Error: 'wp-config.php' not found.
Either create one manually or use `wp config create`.
Error: 'wp-config.php' not found.
Either create one manually or use `wp config create`.
Error: 'wp-config.php' not found.
Either create one manually or use `wp config create`.
Error: 'wp-config.php' not found.
Either create one manually or use `wp config create`.
Error: 'wp-config.php' not found.
Either create one manually or use `wp config create`.
Error: 'wp-config.php' not found.
(... to infinity and beyond ...)

Describe how other contributors can replicate this bug

  • Install a minimal AlmaLinux 8.7 system
  • Install PHP 8.0 packages
  • Create a user (useradd -m user)
  • Give shell access to the new user (usermod -s /bin/bash user)
  • Switch to the new user (su - user)
  • As the new user, download and install wp-cli under ~/bin
  • run wp-cli config create as above
  • watch it loop

Describe what you would expect as the correct outcome

No infinite loop! Maybe stop the config procedure with an error, or proceed and use an alternative to the mysql command.

Let us know what environment you are running this on

$ wp cli info
OS:	Linux 4.18.0-425.3.1.el8.x86_64 #1 SMP Tue Nov 8 14:08:25 CST 2022 x86_64
Shell:	/bin/bash
PHP binary:	/usr/bin/php
PHP version:	8.0.20
php.ini used:	/etc/php-cli.ini
MySQL binary:	
MySQL version:	
SQL modes:	
WP-CLI root dir:	phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:	phar://wp-cli.phar/vendor
WP_CLI phar path:	/home/user/bin
WP-CLI packages dir:	
WP-CLI cache dir:	/home/user/.wp-cli/cache
WP-CLI global config:	
WP-CLI project config:	
WP-CLI version:	2.7.1

$ which -a wp
~/bin/wp

$ stat $(which wp)
  File: /home/user/bin/wp
  Size: 6729511   	Blocks: 13144      IO Block: 4096   regular file
Device: fd00h/64768d	Inode: 8585464     Links: 1
Access: (0755/-rwxr-xr-x)  Uid: ( 1001/user)   Gid: ( 1001/user)
Access: 2022-12-09 13:59:29.395412168 +0000
Modify: 2022-12-09 13:59:12.445309729 +0000
Change: 2022-12-09 13:59:23.846378617 +0000
 Birth: 2022-12-09 13:59:11.708305270 +0000

$ wp package list
+------+---------+---------+--------+----------------+
| name | authors | version | update | update_version |
+------+---------+---------+--------+----------------+
+------+---------+---------+--------+----------------+

Provide additional context/Screenshots

Not applicable.

@danielbachhuber
Copy link
Member

Thanks for the report, @LauraTaylorUK !

Feel free to submit a pull request, if you'd like.

@ghost
Copy link
Author

ghost commented Jan 14, 2023

Nobody cares, closing.

@ghost ghost closed this as completed Jan 14, 2023
@danielbachhuber
Copy link
Member

@LauraTaylorUK I think this is still worth fixing!

Our resources for WP-CLI are quite limited, so bugs can live in the backlog for a bit of time. It's still good to have them captured, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant