Support » Plugin: Local Development » Request plugin not “die()” if wp-config.php is not writable.

  • Resolved Larry Daniele

    (@larrydaniele)


    Thank you for a great plugin!

    I would like to make one request… that the plugin not call die() if it can’t write wp-config.php.

    When I try to start up a site on my localhost machine with all the key site files checked into source control, the site won’t start and I get a “white screen of death” with the message:

    Caught Exception: \Fragen\Local_Development\Init::__construct() – wp-config.php is not writable.

    I understand this is because I set “Set WP_ENVIRONMENT_TYPE” to “Production” on the live site and then this option got transferred to localhost. I just wouldn’t expect WordPress not to start. Maybe display a warning. Maybe just log the error.

    I worked around the problem by going to the wp_options table on my localhost installation database and deleting the “local_development” entry.

    Another work-around was to edit “wp-content/plugins/local-development/src/Local_Development/ini.php and comment out line 95:

    wp_die( esc_html( $messsage ) )

    Not a big deal, but an improvement in this would make a great plugin even better!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Andy Fragen

    (@afragen)

    @larrydaniele this error has nothing to do with the environment variable. I added this try/catch as I found that for some random reason the file_get_contents() in the wp-cli/wp-config-transformer line 70 or so returns empty, even when this is not the case.

    You shouldn’t really see this error and I’m curious as to why you do. The error is about your wp-config.php file being empty.

    Do you consistently see this error? What are you doing to make it occur. I could never figure out when or why if happened.

    Plugin Author Andy Fragen

    (@afragen)

    The line before the wp_die() is commented out and would simply log the error. You could uncomment a that line and comment the wp_die.

    Thread Starter Larry Daniele

    (@larrydaniele)

    @afragen Yes, this problem is repeatable. I believe the problem is that the wp-config.php file is read-only (as it is checked into source control).

    Plugin Author Andy Fragen

    (@afragen)

    @larrydaniele unfortunately the wp-config file being writable is a requirement. Sorry but it doesn’t seem that you will be able to use this plugin.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Request plugin not “die()” if wp-config.php is not writable.’ is closed to new replies.