Hello,
I need to define $PATH variable with a custom path, because my server is shared and my wp-cli installation is not on default dir.
I used this function but it doesn't works for me:
https://danielbachhuber.com/tip/wp-ssh-custom-path/
I put pre-ssh.php on my Bedrock (https://roots.io/bedrock/) project root and I require it in my wp-cli.yml file.
./wp-config.yml
require:
- scripts/pre-ssh.php
@staging:
ssh: [email protected]
path: path/to/my/uploads/web/app/uploads/
./scripts/pre-ssh.php
WP_CLI::add_hook( 'before_ssh', function() {
$host = WP_CLI\Utils\parse_ssh_url( WP_CLI::get_runner()->config['ssh'], PHP_URL_HOST );
switch( $host ) {
case 'mydomain.ch':
putenv( 'WP_CLI_SSH_PRE_CMD=export PATH=/path/to/my/wpcli/installation/bin:$PATH' );
break;
}
});
When I execute wp @staging from my client he say me /bin/bash: wp: command not found.
But wp works on my server (I configure .bashrc file for define my $PATH variable).
I tried other solutions finded here: https://make.wordpress.org/cli/handbook/running-commands-remotely/#making-wp-cli-accessible-on-a-remote-server
but doesn't work either.
What did I wrong ?
Could you help me ?
I remain available for any further informations.
Hello,
I need to define
$PATHvariable with a custom path, because my server is shared and my wp-cli installation is not on default dir.I used this function but it doesn't works for me:
https://danielbachhuber.com/tip/wp-ssh-custom-path/
I put
pre-ssh.phpon my Bedrock (https://roots.io/bedrock/) project root and I require it in mywp-cli.ymlfile../wp-config.yml
./scripts/pre-ssh.php
When I execute
wp @stagingfrom my client he say me/bin/bash: wp: command not found.But
wpworks on my server (I configure.bashrcfile for define my$PATHvariable).I tried other solutions finded here: https://make.wordpress.org/cli/handbook/running-commands-remotely/#making-wp-cli-accessible-on-a-remote-server
but doesn't work either.
What did I wrong ?
Could you help me ?
I remain available for any further informations.