-bash: php: command not found - Centos6.7 - centos

I have two versions of PHP installed on the server:
$ find / -name php -type f
result:
/opt/rh/php54/root/usr/bin/php
/opt/rh/php55/root/usr/bin/php
I've added php54 path to ~/.bash_profile
$ echo $PATH
result:
/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin:/opt/rh/php54/root/usr/bin/php
however $ php -v still doesn't work.
in fact if I $ cd /opt/rh/php54/root/usr/bin and run php -v from the directory itself, it still doesn't work. I get:
-bash: php: command not found
PHP is installed as there are websites running, just command line is not working...
Both
php55-php-cli-5.5.21-4.el6.x86_64
php54-php-cli-5.4.40-2.el6.x86_64
are installed...

Wrong path:
find results:
/opt/rh/php54/root/usr/bin/php
^^^--- your php binary
$PATH expects only DIRECTORIES. You listed the above path in $PATH, which means that the shell will be searching for .../usr/bin/php/php. Note the doubled php. First one is the "directory" that you added in $PATH, while the second one is the program you're trying to run. The $PATH entry should be JUST .../usr/bin/, WITHOUT the php.

Related

Error in run script phase: framework is a directory

I'm using the apollo framework for GraphQL that I installed using Carthage but I have an error when I run the script to generate the API.swift file during the build phase.
The error is
> [myproject]/Carthage/Build/iOS/Apollo.framework: is a directory
Command /bin/sh failed with exit code 126
I did added the script like in the apollo doc :
Here is the script itself:
APOLLO_FRAMEWORK_PATH="$(eval find $FRAMEWORK_SEARCH_PATHS -name "Apollo.framework" -maxdepth 1)"
if [ -z "$APOLLO_FRAMEWORK_PATH" ]; then
echo "error: Couldn't find Apollo.framework in FRAMEWORK_SEARCH_PATHS; make sure to add the framework to your project."
exit 1
fi
cd "${SRCROOT}/${TARGET_NAME}"
$APOLLO_FRAMEWORK_PATH/check-and-run-apollo-codegen.sh generate $(find . -name '*.graphql') --schema schema.json --output API.swift
Of course, I have also generated the schema.json beforehand
Might be a bit late to answer but at least on my machine APOLLO_FRAMEWORK_PATH gets evaluated to two frameworks (iOS and watchOS) and thus running the bundled script with $APOLLO_FRAMEWORK_PATH/check-and-run-apollo-codegen.sh fails.
Assuming the scripts don't differ (as of version apollo-ios#0.8.0 they don't) you can add -print -quit to the end of the find command to make it return only one result.
The full script will be:
APOLLO_FRAMEWORK_PATH="$(eval find $FRAMEWORK_SEARCH_PATHS -name "Apollo.framework" -maxdepth 1 -print -quit)"
if [ -z "$APOLLO_FRAMEWORK_PATH" ]; then
echo "error: Couldn't find Apollo.framework in FRAMEWORK_SEARCH_PATHS; make sure to add the framework to your project."
exit 1
fi
cd "${SRCROOT}/${TARGET_NAME}"
$APOLLO_FRAMEWORK_PATH/check-and-run-apollo-codegen.sh generate $(find . -name '*.graphql') --schema schema.json --output API.swift

Perl Returning error for ls -l command

I am running a perl script from Nagios to check some files for certain characteristics on a windows machine. When I run the script from Nagios it responds with a result of:
UNKNOWN ERROR - execution of LANG=C ls -l resulted in an error 32512 -
My Code is from this GitHub with a single modification of line 168 so I can use it with windows:
use lib 'C$\Progra~1\Nagios\NRDS_Win\plugins';
The odd thing is the program actually outputs the expected result from the command line on the windows machine.
Here is the command:
check_files.pl -D c:\logs -F Health.log -a '~,300'
Here is an example:
CRITICAL - Health.log is 10703 (more than 300) seconds old - 1
Health.log files found
I modified line that defined LANG=C ls -l in the code but now i just get:
UNKNOWN ERROR - could not execute ls -l - No such file or directory
ls is unix command and by default there is no such command in windows.
If you need it, you can install it e.g. from GNU CoreUtils
You also need to change shell command on line 639 from LANG=C ls -l to just ls -l because in windows you can't set environment variables like that.

PostgreSQL command psql not found, trouble adding to $PATH

I am trying to add PostgreSQL to my $PATH variable. I tried this to see where psql is
whereis psql
To which I got a null response. I do have the PostgreSQL.app installed so I clicked on "Open psql" from the GUI and it prompted the Terminal to open and display:
/Applications/Postgres.app/Contents/MacOS/bin/psql; exit;
So I tried to add the above to the $PATH variable in my ~/.bash_profile (which may have its own problems since I don't know if you can add paths with .app extensions to the $PATH) but when I restart my Terminal and do echo $PATH | grep Postgres.app I get nothin'.
Here's an approach to take help isolate problems you may have.
Step 1: See if you can add PostgreSQL to your PATH without using Bash dot files.
$ export PATH=/Applications/Postgres.app/Contents/MacOS/bin:$PATH;
$ which psql
If this works...
Step 2: Verify that ~\.bash_profile is being sourced when a new user session is started.
Add the following to the end of your ~/.bash_profile:
echo "From bash_profile.";
Now restart Terminal.app or iTerm and see if that message appears about your prompt.
If this works...
Step 3: Add PATH to ~/.bash_profile.
In ~/.bash_profile:
export PATH=/Applications/Postgres.app/Contents/MacOS/bin:$PATH;
Restart your terminal and run:
$ which psql
If you're not seeing:
/Applications/Postgres.app/Contents/MacOS/bin/psql
Then it might be time to scrap trying to install PostgreSQL as a Mac package and use Homebrew.
NOTE: It's psql and NOT pgsql.
From the Postgres documentation page:
sudo mkdir -p /etc/paths.d && echo /Applications/Postgres.app/Contents/Versions/latest/bin | sudo tee /etc/paths.d/postgresapp
restart your terminal and you will have it in your path.

Cygwin commands don't work

I'm sorry that my question seems rather vague but this is the entire problem i'm facing. I tried installing an rpm package on cygwin after downloading it from the website but i always get the same error
-bash: rpm: command not found
and I have reinstalled it twice, but i always get the same problem, and it's not just that, i can't even use simple commands like ls. Even if i write ls I get no output. This is what my screen looks like.
User#User-PC ~
$ rpm -ivh avr-binutils-2.17tinyos-3.cygwin.i386.rpm
-bash: rpm: command not found
User#User-PC ~
$ locate rpm | grep bin
User#User-PC ~
$
User#User-PC ~
$ ls
User#User-PC ~
$
what do I do to fix this?
First, locate does not auto-update itself; you must run updatedb periodically to get the current list of files. For optimal speed and usability, add the --prunepaths and --prunefs switches.
Second, try echo $PATH to see the current path, and call ls with a fully-qualified pathname: /bin/ls -l
I suspect ls is set to an invalid alias or internal function (bad command parameters). Check the contents of ~/.bash_profile, ~/.bashrc, and ~/.profile .

ubuntu server PS, ifocnfig, command not working

i am working on ubuntu server from past few months
and now suddenly ps, ifconfing commnad stop working with below error.
user1#Fb1:/usr/bin$ ps
-bash: /bin/ps: No such file or directory
any suggestions to get this command working back.
What's the output of which ps and ls /usr/bin -al (which are both in /bin also)? Does it work if you gain root privileges, either using sudo ifconfig or sudo su, then ifconfig?
This is possibly an issue with file permissions but it's hard to say without more information.
First use locate to find your ps or ifconfig program:
$ locate ps | grep bin
Also you may try whereis command:
$ whereis ps
If you don't find them, try to search as root user.
i have tried to put all the outputs of different commnads as below
root#Fb1:/usr/bin# whereis ps
ps: /bin/ps /usr/share/man/man1/ps.1.gz
root#Fb1:/usr/bin# ls -lsa ps
16 -rwxr-xr-x 1 root root 15859 2010-05-26 12:21 ps
Something wrong with your $PATH I suspect it doesn't have /sbin .. maybe new software overwrite your $PATH..
normal path should be include this (mebada is my user name)
mebada#T430:~$ echo $PATH
/home/mebada/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin