I'm setting up php-fpm on my machine and I installed it using homebrew (specifically homebrew-alt). Everything installed fine and if I open up the terminal and type the command "php-fpm" it starts up fine. Unfortunately if I try to run any commands such as "php-fpm stop" I get the message below. Does anyone have any idea what may be causing this or how I could get it working? If I try killing the process with the kill command it just seems to automatically restart itself.
Usage: php [-n] [-e] [-h] [-i] [-m] [-v] [-t] [-p <prefix>] [-g <pid>] [-c <file>] [-d foo[=bar]] [-y <file>]
-c <path>|<file> Look for php.ini file in this directory
-n No php.ini file will be used
-d foo[=bar] Define INI entry foo with value 'bar'
-e Generate extended information for debugger/profiler
-h This help
-i PHP information
-m Show compiled in modules
-v Version number
-p, --prefix <dir>
Specify alternative prefix path to FastCGI process manager (default: /usr/local/Cellar/php/5.3.8).
-g, --pid <file>
Specify the PID file location.
-y, --fpm-config <file>
Specify alternative path to FastCGI process manager config file.
-t, --test Test FPM configuration and exit
You can use Lanchctl:
Stop:
launchctl unload -w ~/Library/LaunchAgents/homebrew-php.josegonzalez.php55.plist
Start:
launchctl load -w ~/Library/LaunchAgents/homebrew-php.josegonzalez.php55.plist
Adapt the version number "php55" to your environment.
Alternatively, using the USR2 signal makes php-fpm reload its configuration file:
kill -USR2 `cat /usr/local/var/run/php-fpm.pid`
sudo killall php-fpm
Use this command, you can kill php-fpm.
I have tried, it works.
System: Mac OS X 10.11.4
I've php-fpm installed on OSX Lion (through macports), and using the kill command to stop it. It seems to work fine.
Are you trying to kill php-fpm directly, or using the pid file? There will be lots of php-fpm instances, as it works with child-processes, you might not be killing the main app. The command I'm using is
sudo kill `cat /pid-path/php-fpm.pid`
I don't know what the pid file location is set for php-fpm when installed through homebrew. But you can find out from the compiler script, or php-fpm's conf file (if defined).
Also you can update the file database from terminal, and do a locate call.
Try running these commands with sudo
ln -s /usr/libexec/locate.updatedb /usr/bin/updatedb
updatedb
updatedb may take some time to finish. And then just do
locate php-fpm.pid
You're also can close php-fpm in Activity Monitor. Just choose the process and press Quit button.
Related
Im trying to run my .sh scipt status.sh via a telegram message:
Ubuntu 20.04.1 LTS server
Telegram-cli with a lua script to action status.sh script
when i send the message "status" to my server via telegram it actions the status.sh script, in this script i have a bunch of stuff that gathers info for me and sends it back to telegram so i can see what the status of my server is, however (i recently did a fresh install of the server) for some reason if the script has a line of code starting with sudo i get:
line 38: /usr/bin/sudo: Permission denied
if i run the script from the command line ./status.sh it runs without any problem!? so im thinking its because it is being called from telegram or lua!?
example of code that generates the error: sudo ifconfig enp0s25 >> file
on the other hand this line works without a problem:
sudo echo Time: $(date +"%H:%M:%S") > file
/usr/bin has 0755 permission set
sudo has 4755 permission set
The following command
sudo ifconfig enp0s25 >> file
would not work if file requires root privilege to be modified.
sudo affects ifconfig but not the redirection.
To fix it:
sudo sh -c 'ifconfig enp0s25 >> file'
As mentioned in Egor Skriptunoff's answer, sudo only affects the command being run with sudo, and not the redirect.
Perhaps nothing is being written to file in your case because ifconfig is writing the output you are interested in to stderr instead of to stdout.
If you want to append both stdout and stderr to file as root, use this command:
sudo sh -c 'ifconfig enp0s25 >> file 2>&1'
Here, sh is invoked via sudo so that the redirect to file will be done as root.
Without the 2>&1, only ifconfig's stdout will be appended to file. The 2>&1 tells the shell to redirect stderr to stdout.
If file can be written to without root, this may simplify to
sudo ifconfig enp0s25 >> file 2>&1
All of a sudden today Docker on my Mac stopped working with a 'failed to install symlinks"
I tried to get back to a clean state by uninstalling Docker and trying to remove all symlinks in the /usr/local/bin. I'm left with two simlinks docker-compose and docker-machine that I cannot remove even with sudo.
Any suggestion on how to delete those files (that I suspect are the root of the problem) so I can do a clean install?
Not sure if helps but 'Macfee Endpoint security' is running on my Mac.
I recently have the same problem on my mac.
I resolved it by changing the owner of /usr/local/bin by the current user like that:
# sudo chown -R $(whoami) /usr/local/bin
This is possibly a broken symlink. Please use this command to find if it’s pointing to an existing parent file:
# ls -lh file
From the output of the command above, if it points to broken parent file, then force the removal of that file first as root:
# rm -rf <broken-referenced-file>
And then unlink the binary symlinks:
# unlink <file>
Also make sure there is no running process related to docker and that no open files are being held by any docker associated process. To get a list of open files do this:
# lsof | grep deleted
# lsof | grep -i docker
# lsof | grep deleted | grep -i docker
Compare the outputs to see if there are any for docker; if so, kill the process using:
# kill -SIGKILL <PID>
And again try unlinking.
I ran into this exact same problem this morning ... but instead of jumping straight into file deletion I restarted my mac and all is well again.
Just saying that more often than not a reboot can fix many problems.
I had the same issue. I find bin some what messed in /usr/local/bin. I took a backup of /usr/local/bin and deleted it and recreate new directory /usr/local/bin with same permissions. Then it worked.
When using sudo lein run (because some of the files changed by that command need priveleges) I get this message:
WARNING: You're currently running as root; probably by accident.
Press control-C to abort or Enter to continue as root.
Set LEIN_ROOT to disable this warning.
Any idea how or where to set LEIN_ROOT in order to avoid getting this message?
Add LEIN_ROOT=true to the end of /etc/profile. For this change to take effect, enter source /etc/profile to a terminal. Then run the command with sudo -E lein run to preserve environment variables.
If you are doing this over ssh you would need to do all of the above on the server then add source /etc/profile to the start of the ssh command run on the local machine.
ssh user#123.456.789 "source /etc/profile; sudo -E lein run"
I am trying to do a syntax check on an upstart script using init-checkconf. However when I run it, it returns ERROR: version of /sbin/initctl too old.
I have no idea what to do, I have tried reinstalling upstart but nothing changes. This is being run from within a docker container (ubuntu:14.04) which might have something to do with it.
I just ran into the same issue.
Looking in the container:
root#puppet-master:/# cat /sbin/initctl
#!/bin/sh
exit 0
I haven't tested it completly yet, but I added the following to my Dockerfile:
# Fix upstart
RUN rm -rf /sbin/initctl && ln -s /sbin/initctl.distrib /sbin/initctl
I thought this link explained it pretty good:
When your Docker container starts, only the CMD command is run. The only processes that will be running inside the container is the CMD command, and all processes that it spawns. That's why all kinds of important system services are not run automatically – you have to run them yourself.
Digging around some more, I found an official Ubuntu image containing a working version of upstart:
https://registry.hub.docker.com/_/ubuntu-upstart/
Help!
I want to set up a monitoring service on my Debian server, that will monitor and start wen needed the updater for tiny tiny rss. The problem is that it is a php foreground process normally run in a screen on a non-root user.
I can run it as:
php ./update_daemon2.php
or better putting it in the background and in order to run it from a different account
sudo -u tinyrssuser php ./update_deamon2.php -daemon > /dev/null & disown $!
I have installed monit, but cant seem to find a way to have it detect if t is running.
I would prefer to keep with monit but it is not necessary.
Any ideas would be appreciated.
Found the answer at:
http://510x.se/notes/posts/Install_Tiny_Tiny_RSS_on_Debian/
But use this instead under /etc/init.d/
http://mylostnotes.blogspot.co.il/2013/03/tiny-tiny-rss-initd-script.html
make sure to set the user and group
Create an upstart script /etc/init/ttrss.conf:
description "TT-RSS Feed Updater"
author "The Epyon Avenger <epyon_avenger on TT-RSS forums>"
env USER=www-data
env TTRSSDIR=/var/www/ttrss
start on started mysql
stop on stopping mysql
respawn
exec start-stop-daemon --start --make-pidfile --pidfile /var/run/ttrss.pid --chdir $TTRSSDIR --chuid $USER --group $USER --exec /usr/bin/php ./update_daemon2.php >> /var/log/ttrss/ttrss. log 2>&1
Start the script:
sudo start --system ttrss
Add the following lines to your monit conf:
check process ttrss with pidfile /var/run/ttrss.pid
start program = "/sbin/start ttrss"
stop program = "/sbin/stop ttrss"