-
Notifications
You must be signed in to change notification settings - Fork 37

Description
Bug Report
- Yes, I reviewed the contribution guidelines.
- Yes, more specifically, I reviewed the guidelines on how to write clear bug reports.
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.