Skip to content

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

@naqirizvi

Description

@naqirizvi

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions