How to restart FastCGI process from source? - fastcgi

I have Plesk 12, and I installed another version of PHP using this guide. I switched a specific domain to use this version. So in the hosting settings, it says
PHP support (Run PHP as [FastCGI application], PHP version 5.3.1
Now, I needed to edit the php.ini file to turn on short tags (eww gross I know), but I can't turn them on. When I run service apache2 restart it doesn't restart FastCGI. It is installed at /usr/local/php531-cgi
ls -l
-rw-r--r-- 1 root root 1204 Mar 18 22:47 pear.conf
-rw-r--r-- 1 root root 69623 Mar 18 23:36 php.ini
I tried restarting the entire server, setting ini_set('short_open_tag',true);, and the commands service php5-fpm restart / service php-fpm restart
But the results are the same, short_open_tag Off

I followed #mario's advice, and checked phpinfo(). I was using the wrong php.ini file. I was using /usr/local/php531-cgi/etc/php.ini. The one I needed to use was in /var/www/vhosts/system/[domainname.com]/php.ini
I didnt even need to restart anything. Thanks Mario!

a quick command to see which php.ini file you're using
php -i | grep /php.ini

Related

Docker Unknown File Permissions Windows 10

I have an application running inside docker which programmatically creates files. Most of the time files are created properly and then deleted. Sometimes a file with unknown permission is created
drwxrwxrwx 0 root root 4096 Apr 17 21:41 ..
-????????? ? ? ? ? ? __CG__NarwhalLayoutDomainEntitiesTheme.php
-rwxrwxrwx 1 root root 8314 Apr 19 12:46 __CG__NarwhalLayoutDomainEntitiesTheme.php.5ad802fc34f6b0.60147712
When that happens though I can see the file in Windows Explorer when I try to delete it I get this error:
"You need permission to perform this action"
"You require permission from the computer's administrator to make changes to this file"
I even tried as administrator but it still won't work and when I try to delete the file from inside the container shell. I get this error:
rm: cannot remove '__CG__NarwhalLayoutDomainEntitiesTheme.php': No such file or directory
This problem goes away when I restart the docker but I don't want to restart docker every few minutes.
Looks like this is an ongoing problem with docker for windows. I found a temporary solution here https://github.com/docker/for-win/issues/525
I fixed the problem by simply pointing my doctrine proxies to a folder inside the container such as /tmp and is not mounted.

Strange error about permissions inside a docker container

I'm running an official tomcat image (https://github.com/docker-library/tomcat/tree/master/8.5/jre8) with customized permissions applied : I've created a tomcat:tomcat user and group and made him owner of /usr/local/tomcat and all subdirectories.
In /usr/local/tomcat, when I do "touch test" or "mkdir testdir", it works, but if I do the same thing in "work" subdirectory or any subdirectory, it fails.
tomcat#462080a55bca:/usr/local/tomcat$ ll | grep work
drwxr-x--- 2 tomcat tomcat 4096 Jan 10 21:03 work
tomcat#462080a55bca:/usr/local/tomcat$ touch work/test
touch: cannot touch ‘work/test’: Permission denied
tomcat#462080a55bca:/usr/local/tomcat$ mkdir work/testdir
mkdir: cannot create directory ‘work/testdir’: Permission denied
Anyone can tell me why ?
This is a bug in linux Kernel (and maybe also on aufs/overlay2).
It's fixed in kernel >= 4.7
See here for more details : https://github.com/docker/docker/issues/30285
Additional informations from Justin Cormack (engineer at Docker) : "Many of these fixes are being backported to the stable 4.4 kernels", "The new Debian stable with 4.9 kernel will be out in a few months, and Docker for AWS and Azure also have 4.9 kernels." (It will actually be 4.10 for Debian, and maybe later than expected but still first half of 2017).

Jenkins installation - Unable to create the home directory despite its existence and writeability

I'm trying to install Jenkins on a Tomcat 7 container.
When I try to open the Jenkins web app I get following error:
Unable to create the home directory '/home/myuser/jenkins/work'. This is most
likely a permission problem.
To change the home directory, use JENKINS_HOME environment variable or set
the JENKINS_HOME system property. See Container-specific documentation for
more details of how to do this.
Before starting Tomcat, I did chmod uog+rwx /home/myuser/jenkins. So, I suppose that Jenkins should be able to create a subdirectory there.
But obviously it can't.
How can I fix this problem?
Update 1:
lt -lt returns
drwxrwxrwx 2 root ec2-user 4096 Jun 23 10:25 jenkins
for /home/myuser/jenkins. /home/myuser/jenkins/work doesn't exist because Jenkins is supposed to create it.
Update 2: Just tried to create the work directory and to run chmod uog+rwx on it. It didn't help.
Update 3: Additional information:
I need Jenkins in order to
run lengthy tests in the night (fast unit tests are run before every mvn install, slow tests are executed every night) and
save software quality metrics (checkstyle, PMD, FindBugs, unit test coverage etc.) over time.
I have only one machine available for that and there is a Tomcat7 container installed there already.
At the moment, I don't want to invest additional money into buying new machines.
The machine with the Tomcat7 container (and where I want Jenkins to be installed) is an Amazon EC2 microinstance (OS version is given below).
$ cat /etc/*-release
LSB_VERSION=base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Amazon Linux AMI release 2013.03
Update 4 (29.06.2013 13:34 MSK): The output of yum list does not contain any Jenkins/Hudson package.
If Tomcat is running as a separate user you will need to give execute permission to your home directory to that user - either by giving it to all or by creating a group especially for you and the tomcat user.
(UPDATE) More specifically: You say you already did chmod uog+rwx /home/myuser/jenkins, if Tomcat is not running asl 'myuser' it also needs execute permission on /home and on /home/myuser to be able to open /home/myuser/jenkins. If you are not picky about other users on the system opening your homedir you could allow this by: chmod a+x /home/myuser. (I'm assuming here the permissions for /home are already ok)
If you are running tomcat as 'myuser' the filsystem permissions look fine, but Tomcat's own permission system might be the problem as webapps are not allowed to touch the filesystem if the default settings of the security manager are on.
See: https://wiki.jenkins-ci.org/display/JENKINS/Tomcat
You don't specify more about your exact Tomcat/OS setup so I can't give exact details, but the fast way to find out if it's a security manager issue is to give AllPermission to you webapp. If you don't run in a safe environment it is advisable to only use that as a test, and setup only the really needed permissions later.
run these three commands
cd /usr/share/tomcat7
sudo mkdir .jenkins
sudo chown tomcat7:nogroup .jenkins
https://seleniumwithjavapython.wordpress.com/home/jenkins-installation/
It looks like the problem may be that jenkins cannot see /home/myuser, and therefore it cannot access the jenkins folder inside this (even though it has write permissions in /home/myuser/jenkins, I believe the fact it can't read /home/myuser causes a problem).
Try running the below command and then see if Jenkins works after that:
chmod +r /home/myuser
#robjohncox Yes - drwx------ 5 myuser myuser 4096 Jun 23 10:25 myuser
you must add +x to this dir to make it possible for jenkins to access it's contents, to be precise whole path has to have +x enabled for everyone.
Also, what commands have you used to move it's home dir from default - possible error is somwhere there. Cheers, Piotr

Erlang install: "Can't find config file " error message

I'm trying to install Yaws on my Ubuntu 11.01 system via apt-get install yaws. But when I call the shell script yaws from the command line I get the following error: Yaws: Bad conf: "Can't find config file "
Unless my aging eyes are missing something, I can't find enlightenment in either the Yaws website or Zachery Kessin's book.
I can find configuration files in /etc/yaws. But is there something else I need to know/do?
Thanks,
LRP
If you installed yaws with the package manager then it's controlled by an init script (and you should work with that instead of running yaws manually, I'll add).
You're most likely running yaws as a non-privileged user, and if you look closely, the directory /etc/yaws is:
drwxr-x--- 4 root yaws 4096 Aug 7 10:36 yaws
You're probably trying to run yaws under a user other than root, and without membership in the yaws group.
I would venture a guess that this is a bug in the distro's packaging rather than in yaws since the man page clearly states that running it as a non-privileged user it falls back to reading /etc/yaws/yaws.conf, except that under Debian/Ubuntu (I'm on Debian 6) the permissions on /etc/yaws/ do not live up to the claim in the map page.
But, if you work through the distro's init script and daemon management facilities your problem goes away magically. That I think is preferable to tapping the Debian packager on the shoulder and having a long conversation about config directory permissions. :)
Try doing the following.
$ touch yaws.conf
$ yaws
Hit the enter key to bring up the prompt. Works on Debian 7 (wheezy).
You may also want to do the following to place your username in the yaws group.
$ adduser USERNAME yaws
To one of the maintainers of this package found in the readme file, I have pointed them to here.
$ dpkg -L yaws | grep -i readme
My system is Debian 7 or often called wheezy distro. It's actually kali-linux but that's just fyi stuff. I browsed to /etc/yaws as root with nautilus otherwise it's locked.
~$ sudo su
[sudo] password for username:
# nautilus
Initializing nautilus-gdu extension
Now you may look in the /etc/yaws directory.
The yaws.conf should be in there. Josef would be correct as this is what yaws will try to use if the user has access to this file. But not being root you don't.
My solution is to just get ideas out of that file and the others within the same directory. Take this next answer from Van and make your home/user have a yaws.conf and play around with different configurations from what you found in the etc one. Not that hard to copy and paste if you just have access to the files. Enjoy! :-D

How to run redis server and juggernaut server in production mode

I am using juggernaut push server. How to start redis and juggernaut in production mode cause I
juggernaut
or
redis-server will keep on showing me log etc.
I am using ruby on rails 3.
EDIT
I followed these two guides to setup juggernaut and redis on production server
Seems like both the servers are running smooth now. But how can i access
:8080/application.js for juggernaut.
I tried
my_ip:8080/application.js but nothing.
For hosting I am using Linode.
EDIT2
When I am trying to stop/start redis server its gives me output ie:
Starting/Stopping redis-server: redis-server.
But nothing when i m doing the same for juggernaut. Check screenshot.
EDIT
I can't see any log for juggernaut.. There is one for redis but nothin for juggernaut
EDIT
Executable file permissions to /etc/init.d/juggernaut file -- YES
-rwxr-xr-x 1 fizzy fizzy 1310 Sep 19 11:06 juggernaut
PIDFILE=/var/run/juggernaut.pid' is defined. Does that exist? --- NO
In the 'start' part it runs 'chown juggernaut:juggernaut'. Does the user juggernaut exist and is it member of the group juggernaut? -- YES/YES
cat /etc/group
redis:x:1002:
juggernaut:x:113:
groups juggernaut
juggernaut : juggernaut
EDIT
fizzy#li136-198:~$ sudo ls -l /usr/bin/juggernaut
ls: cannot access /usr/bin/juggernaut: No such file or directory
fizzy#li136-198:~$ sudo ls -l /usr/local/bin/juggernaut
lrwxrwxrwx 1 root root 40 Sep 20 02:48 /usr/local/bin/juggernaut -> ../lib/node_modules/juggernaut/server.js
I tried changing
DAEMON=/usr/bin/juggernaut
to
DAEMON=/usr/local/bin/juggernaut
after that i tried restarting the juggernaut using
sudo /etc/init.d/juggernaut start
Server started but not as background process/service.
EDIT
Running script in debugging mode ie
changing the shebang line at the top to add an -x, eg
#! /bin/bash -x
Here is the output:-
+ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+ DAEMON=/usr/bin/juggernaut
+ NAME=Juggernaut2
+ DESC=Juggernaut2
+ PIDFILE=/var/run/juggernaut.pid
+ test -x /usr/bin/juggernaut
+ exit 0
EDIT
Changing path of my juggernaut as it seems my juggernaut is installed somewhere else. Now here is the output
fizzy#li136-198:~$ sudo /etc/init.d/juggernaut start
+ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+ DAEMON=/usr/local/bin/juggernaut
+ NAME=Juggernaut2
+ DESC=Juggernaut2
+ PIDFILE=/var/run/juggernaut.pid
+ test -x /usr/local/bin/juggernaut
+ set -e
+ case "$1" in
+ echo -n 'Starting Juggernaut2: '
Starting Juggernaut2: + touch /var/run/juggernaut.pid
+ chown juggernaut:juggernaut /var/run/juggernaut.pid
+ start-stop-daemon --start --quiet --umask 007 --pidfile /var/run/juggernaut.pid --chuid juggernaut:juggernaut --exec /usr/local/bin/juggernaut
20 Sep 06:41:16 - Your node instance does not have root privileges. This means that the flash XML policy file will be served inline instead of on port 843. This will slow down initial connections slightly.
20 Sep 06:41:16 - socket.io ready - accepting connections
node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: EADDRINUSE, Address already in use
at Server._doListen (net.js:1106:5)
at net.js:1077:14
at Object.lookup (dns.js:153:45)
at Server.listen (net.js:1071:20)
at Object.listen (/usr/local/lib/node_modules/juggernaut/lib/juggernaut/server.js:51:21)
at Object.listen (/usr/local/lib/node_modules/juggernaut/lib/juggernaut/index.js:9:10)
at Object.<anonymous> (/usr/local/lib/node_modules/juggernaut/server.js:21:12)
at Module._compile (module.js:402:26)
at Object..js (module.js:408:10)
at Module.load (module.js:334:31)
+ echo failed
failed
+ exit 0
You probably want to start Juggernaut and Redis as a service / background process. Starting it as a service gives the opportunity to redirect the logs to a file which you then can inspect regularly.
To create a service that automatically starts at boot time, you have to do different things based on the OS you're using:
In Linux you can add an init.d script (Juggernaut Ubuntu example, Redis Ubuntu example)
In Mac OS X you use launchd.
In Windows you use this method.
Make sure you start the services after creating them by adding the service to the default runlevel (will start automatically during boot time) or start them manually.
Add service to default runlevel (Linux), is also part of both the Linux tutorials above:
sudo update-rc.d -f juggernaut defaults
sudo update-rc.d -f redis-server defaults
After adding the service to the default runlevel, you still need to start the service manually (Linux):
sudo /etc/init.d/juggernaut start
sudo /etc/init.d/redis-server start
I ran into the same problem (using Ubuntu 12.04 LTS). Using upstart did it for me.
Create a file 'juggernaut.conf' containing:
start on filesystem and started networking
stop on shutdown
script
# We found $HOME is needed. Without it, we ran into problems
export HOME="/root"
exec /usr/local/bin/juggernaut 2>&1 >> /var/log/juggernaut.log
end script
Save this file in /etc/init/ (not init.d) and make it executable (chmod +x). This is it, Juggernaut runs as a deamon if the server started.
A note: next to the juggernaut.log of juggernaut itself, there is a juggernaut.log located in /var/log/upstart/ where information is written on the attempts of upstart to start juggernaut.
I more or less copy-pasted the above script from this blog . However, the script shown there started with:
start on startup
This did not work for me, because the filesystem was not mounted properly at startup, so no possibility to create juggernaut.log (Read-only filesystem error). Credits to this post on serverfault for solving that.

Resources