Running wp-cli from bash script results in path error - bash

I have successfully installed wp-cli on my remote server and created the "wp" alias. I use Putty to connect via SSH, and everything works just fine. First, I used a .user_bashrc file to set the alias with:
alias wp='/www/htdocs/w019d58a/wp-cli.phar'
The path is set in .user_bashrc using:
export PATH=/www/htdocs/w019d58a/:$PATH
However, when I tried to run wp-cli from a bash script, I got a "wp command not found" error. I contacted the support, and they recommended a symlink. So, I created a symlink using:
ln -s /www/htdocs/w019d58a/wp-cli.phar wp
Everything works but the installation process. I can, for example, install a plugin using:
#!/bin/bash
wp plugin install akismet
Unfortunately, I can't download WordPress via the bash script using:
wp core download --locale=de_DE_formal
I always get the error:
Error: Too many positional arguments:
Error: This does not seem to be a WordPress installation.
Pass --path=path/to/wordpress or run wp core download.
I tried to add the path using:
wp core download --locale=de_DE_formal --path="/www/htdocs/w019d58a"
No luck. I stil get the same error.
I can download and install WordPress directly from the console and do further operations using a script. But I can't download and install it from the script due to the path error.
Any ideas how to fix that?
I've just found out, that the download is working fine:
#!/bin/bash
wp core download --locale=de_DE_formal
It's the config create part that causes trouble:
wp config create --dbname=d123456 --dbuser=d123456 --dbpass=123456 --dbhost=localhost --dbprefix=wplcli_

Related

Installing Github .zip files on Chromebook via Linux

I'm using a Linux Debian terminal, trying to install a Github .zip file by following a walkthrough (from Chromebook). They're using a Windows terminal and access the zip file from a G: drive. They run the following:
C:\Users\zasur>G:
G:\>cd filename.zip
G:\filename>npm install
Which installs the Github zip. I've looked all over online and tried a few different solutions but can't get past the second command they run.
I was able to open /mnt/chromeos/MyFiles/Downloads from Linux by sharing the Downloads folder with it.
I'm not sure how to change the directory from here to the filename.zip and/or run commands from it. Whenever I try to run cd filename.zip or cd /mnt/chromeos/MyFiles/Downloads/filename.zip it always fails. Is this even possible on a Chromebook?

TYPO3 v10: Install extension with cmd on Windows 10

I'm trying to install a typo3(v10) extension with composer under XAMPP in the C:\xampp\htdocs\typo3\public\typo3 folder. I'm on Windows 10, I use cmd in admin to install with composer.
With cmd, I accessed my TYPO3 folder using the following command: cd C:\xampp\htdocs\typo3 then I started composer. I typed the command:
composer require typo3/cms-introduction
I get a message that told me the extension is installed. Following the instructions, I must now enter the following commands:
./vendor/bin/typo3 extension: activate bootstrap_package
./vendor/bin/typo3 extension: activate introduction
But cmd returns me the following message (an english translation from the message i get in french)
'.' is not recognized as an internal order or external, an executable
program or a batch file.
How can I activate those 2 extensions?
(De-)Activating TYPO3 extensions is always possible via the extension manager module in the TYPO3 backend.
Side note:
Maybe you want to check out DDEV-local as local development environment instead of XAMPP. DDEV uses Docker and is an awesome powerful tool but easy to use. And it provides a native shell for commands like yours above.
A big plus is the very helpful community. If you have problems, register an account at my.typo3.org, request your TYPO3 Slack invitation and go to the #ddev Slack channel.
This works on Windows:
vendor\bin\typo3 extension:activate <EXTKEY>
Note: You have to solve dependencies manually, but you will be warned and the extension will not be activated if dependencies are absent.

gCloud SDK failed to install in macOS behind corporate proxy

I am trying to install gcloud SDK while using a coporate network which works behind a proxy (and a VPN sometimes). I get proxy settings automatically using a pac.fcgi file (Automatic Proxy Configuration).
Now when I try to run ./install.sh in the terminal, I am constantly getting the following error
➜ google-cloud-sdk ./install.sh
Welcome to the Google Cloud SDK!
To help improve the quality of this product, we collect anonymized usage data
and anonymized stacktraces when crashes are encountered; additional information
is available at <https://cloud.google.com/sdk/usage-statistics>. You may choose
to opt out of this collection now (by choosing 'N' at the below prompt), or at
any time in the future by running the following command:
gcloud config set disable_usage_reporting true
Do you want to help improve the Google Cloud SDK (Y/n)?
ERROR: (gcloud.components.list) Failed to fetch component listing from server. Check your network settings and try again.
I found this SO question which was having the same issue, but their problem was related to ipv6. I already have ipv6 disabled (I can't even enable it) and I am using ethernet to connect to the network. Thus the answer is not useful to me.
I searched for proxy related info about installation and found this page. It asks for using a non-interactive installer instead and using gcloud command to set the proxy after installation. My problem is that I can't even install gcloud. I have tried with both interactive and non-interactive installers.
Any way I can install gcloud while being behind a corporate proxy.
PS: I am on macOS High Sierra and using zsh shell (already tried bash), in case it matters.
So, the problem was I was unable to set proxy before installation of gcloud. The installation of gcloud basically set the CLI in the path and installs some required components (core, bq, gsutil etc).
So what I did is I added the following lines in my .zshrc
source <PATH to gcloud sdk>/google-cloud-sdk/path.zsh.inc
source <PATH to gcloud sdk>/google-cloud-sdk/completion.zsh.inc
or if you're using bash, add these lines in your .bashrc or .bash_profile
source <PATH to gcloud sdk>/google-cloud-sdk/path.bash.inc
source <PATH to gcloud sdk>/google-cloud-sdk/completion.bash.inc
After that I restarted the terminal (or just run source ~/.zshrc or source ~/.bashrc or source ~/.bash_profile on terminal)
Now I was able to use gcloud commands. I ran gcloud init, set the proxy and then installed the required components using the following command -
gcloud components install core bq gsutil
And I installed gcloud without using the install.sh script.
PS: Run scutil --proxy to know the proxy settings set in your system.
For Windows 10 users who experience this issue. I installed the google SDK from the archived versions page. then used git bash to install using ./google-cloud-sdk/install.sh. then added in environment variable manually to PATH to use commands.

Installing Glassfish, Wildfly using homebrew on Mac OSX

Trying to install Glassfish(Java EE App. Server) and Wildfly App Server using Homebrew .
http://macappstore.org/wildfly-as/
http://macappstore.org/glassfish/
used these above mentioned tutorials .
I got the following errors while trying to run them by typing just "glassfish" & "wildfly-as" respectively.
Output(Error):
-bash: glassfish: command not found
-bash: wildfly-as: command not found
Searched about it and I think it has something to do with $PATH. I don't understand $PATH Variable . Need help.
The issue is that there are two asadmin scripts. One at $GLASSFISH_HOME/bin and one at $GLASSFISH_HOME/glassfish/bin
Here are full instructions to get your domain up
brew update
brew install glassfish
you should see message, add that line to your .bash_profile
==> Caveats
You may want to add the following to your .bash_profile:
export GLASSFISH_HOME=/usr/local/opt/glassfish/libexec
Open a new terminal then, cd $GLASSFISH_HOME/glassfish/bin
./asadmin start-domain --verbose
Browse to http://localhost:8080 for welcome page and http://localhost:4848 for admin console
I actually installed Wildfly-Application Server using homebrew but could not find a way to run it.
https://tomylab.wordpress.com/2016/07/03/how-to-install-wildfly-on-mac/
This tutorial helped me .
And for glassfish, my installation was again successful using homebrew but was not able to run it . I did figure it out when I ran the following commands.
$ cd /usr/local/opt/glassfish/libexec/bin
$ ./asadmin
asadmin> start-domain
You need to understand about the PATH variable. It is an environment variable on Unix-like operating systems, specifying a set of directories in which executable programs are located. In general, each executing process, or user session, has its own PATH setting.
So, you need to add the glassfish home path to your actual path variable.
Now, as per your problem with running the Glassfish server; try this:
export GLASSFISH_HOME=/usr/local/opt/glassfish/libexec/
export PATH=$PATH:$GLASSFISH_HOME/bin
Add it to your bash profile, if you do not want to do this everytime.

Class 'AMQPConnection' not found

I am using Mac OSX Lion. I am running php ver 5.3.6 through MAMP and when trying the create a AMQPConnection I get this error
Class 'AMQPConnection' not found
I installed rabbitmq through macports using this command
$ sudo port install rabbitmq-server
I run the server using this command
$ sudo rabbitmq-server -detached
It all works fine
I added "extension=amqp.so" to my php.ini file. More specifically my /Applications/MAMP/bin/php/php5.3.6/conf/php.ini file.
I have rabbitmq-c
I ran autoreconf -i && ./Configure && make && sudo make install with no errors
I configured rabbit with this command phpize && ./configure && make && make install
All that seemed to go perfectly.
I even created my user with permissions and verified those permissions with the web plugins that can be accessed through localhost:55672
I even tried copying amqp.so into my /Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/ file in a futile attempt to get it working.
Everything that I have done has seemed to work flawlessly. I get no error/warning messages. The Rabbit server is running. I ran it without the -detached option to see if I was getting any errors there. Nothing.
Any Suggestions??????
Best way to test your RabbitMQ Server installation is by testing with simple python code.
Installing PIKA library on Mac OSX is very easy. Follow the steps given here.
http://www.rabbitmq.com/tutorials/tutorial-one-python.html
copy paste and create two python files receive.py and send.py. Execute these from two terminal windows. In about 10 minutes you'll know that RabbitMQ is able to receive the message and queue.
Create the info.php on server with
Check the results from browser if it shows AMQP library is active.
I feel your RabbitMQ server is installed, but PHP library is not getting loaded correctly.
Check your error.log. There must be some details why it is failing to load 'amqp.so' file.
Can You please Add:
use PhpAmqpLib\Message\AMQPMessage;
under your:
use PhpAmqpLib\Connection\AMQPStreamConnection;
line and it will work.

Resources