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

WP Config set gives Error: Could not process the 'wp-config.php' transformation. #155

Open
naqirizvi opened this issue Apr 3, 2023 · 1 comment

Comments

@naqirizvi
Copy link

Bug Report

Describe the current, buggy behavior
wp config set foo bar is not working as expected and gives output

Error: Could not process the 'wp-config.php' transformation.
Reason: Failed to update the config file.

However, the anchor text is correct.

/* Add any custom values between this line and the "stop editing" line. */

/* That's all, stop editing! Happy publishing. */

Expected Response:
Success: Added the constant 'foo' to the 'wp-config.php' file with the raw value 'bar'.

Environment:

  • cPanel
  • Softaculous
  • WP-CLI 2.7.1
  • Wordpress 6.2
  • PHP 7.2,7.4,8.0
wp --info
OS:     Linux 3.10.0-962.3.2.lve1.5.42.el7.x86_64 #1 SMP Mon Nov 9 08:11:18 EST 2020 x86_64
Shell:  /usr/bin/bash
PHP binary:     /opt/alt/php74/usr/bin/php
PHP version:    7.4.33
php.ini used:   /opt/alt/php74/etc/php.ini
MySQL binary:   /bin/mysql
MySQL version:  mysql  Ver 15.1 Distrib 10.3.38-MariaDB, for Linux (x86_64) using readline 5.1
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/cq60tjb
WP-CLI packages dir:    /home/cq60tjb/.wp-cli/packages/
WP-CLI cache dir:       /home/cq60tjb/.wp-cli/cache
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 2.7.1

Provide a possible solution
Wp-config.php has the correct Anchor text. The issues are replicate able on a fresh install.

Provide additional context/Screenshots
image

image
When --raw is added the command works fine
wp config set foo bar --raw

@danielbachhuber
Copy link
Member

Thanks for the report, @naqirizvi

I'm unable to reproduce the issue on my local machine:

$ wp config set foo bar
Success: Added the constant 'foo' to the 'wp-config.php' file with the value 'bar'.
$ wp cli info
OS:	Darwin 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:38:37 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6000 arm64
Shell:	/bin/zsh
PHP binary:	/opt/homebrew/bin/php
PHP version:	8.0.27
php.ini used:	/opt/homebrew/etc/php/8.0/php.ini
MySQL binary:	/opt/homebrew/bin/mysql
MySQL version:	mysql  Ver 8.0.32 for macos13.0 on arm64 (Homebrew)
SQL modes:
WP-CLI root dir:	/Users/danielbachhuber/projects/wp-cli-dev/wp-cli
WP-CLI vendor dir:	/Users/danielbachhuber/projects/wp-cli-dev/wp-cli/vendor
WP_CLI phar path:
WP-CLI packages dir:	/Users/danielbachhuber/wp-cli/packages/
WP-CLI cache dir:	/Users/danielbachhuber/.wp-cli/cache
WP-CLI global config:	/Users/danielbachhuber/.wp-cli/config.yml
WP-CLI project config:	/Users/danielbachhuber/projects/vanilla/wp-cli.yml
WP-CLI version:	2.8.0-alpha

A few thoughts, to potentially help move this along:

  • Can you see if it reproduces for you in another environment?
  • Can you share your full wp-config.php (with any secrets nulled out) so I can inspect it?
  • It looks like there are some failures in the underlying wp-config-transformer package that might be related https://github.com/wp-cli/wp-config-transformer

Feel free to stop by the #cli channel on WordPress.org Slack if you'd like help debugging further.

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

2 participants