extension-command
extension-command copied to clipboard
Moving wp-config.php to other location
I moved my wp-config.php to another location, but when I run a command it gives me an error. I followed https://gist.github.com/samstoller/efc38eb309e62df392ea to resolve it, but it was a no go.
<?php
/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
/** Location of your WordPress configuration. */
require_once(ABSPATH . '../private/some-config.php');
/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-config.php');
The error I get it
PHP Fatal error: Cannot redeclare wp_get_server_protocol() (previously declared in /home/nginx/domains/domain.com/public/wp-includes/load.php:16) in /home/nginx/domains/domain.com/public/wp-includes/load.php on line 21
Error: De site ondervindt technische problemen.
PHP Fatal error: Cannot redeclare wp_get_server_protocol() (previously declared in /home/nginx/domains/domain.com/public/wp-includes/load.php:16) in /home/nginx/domains/domain.com/public/wp-includes/load.php on line 21
Error: De site ondervindt technische problemen.
Reloading nginx configuration (via systemctl): [ OK ]
Current place of files
├── private
│ └── some-conf.php <----|
├── public |
│ ├── index.php |
│ └── wp-config.php -----| (required file)
A clear and concise description of what you expected to happen (or code). A working CLI without PHP errors
Let us know what environment you are running this on Centos 7.6 x64
wp cli info
OS: Linux 3.10.0-957.12.2.el7.x86_64 #1 SMP Tue May 14 21:24:32 UTC 2019 x86_64
Shell: /bin/bash
PHP binary: /usr/local/bin/php
PHP version: 7.2.6
php.ini used: /usr/local/lib/php.ini
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: /root/tools
WP-CLI packages dir: /root/.wp-cli/packages/
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 2.2.0