You are not logged in.
Pages: 1
I've got a fastcgi script that I use for Ubuntu and I'm trying to get it running under Arch. So far it works when I run it myself, but when I try to run it as root I get output that says:
[1]+ Exit 1 nohup env - $E sh -c "$EX" >&/dev/nullI figure I'm just a little unfamiliar with Arch compared to Ubuntu.. could somebody take a look at the script and give me a hand? Nginx is a great webserver..
#!/bin/bash
## ABSOLUTE path to the PHP binary
PHPFCGI="/usr/bin/php-cgi"
## tcp-port to bind on
FCGIPORT="8888"
## IP to bind on
FCGIADDR="127.0.0.1"
## number of PHP children to spawn
PHP_FCGI_CHILDREN=5
## number of request before php-process will be restarted
PHP_FCGI_MAX_REQUESTS=1000
## if this script is run as root switch to the following user
USERID=nginx
################## no config below this line
if test x$PHP_FCGI_CHILDREN = x; then
PHP_FCGI_CHILDREN=5
fi
LLOWED_ENV="$ALLOWED_ENV PHP_FCGI_CHILDREN"
ALLOWED_ENV="$ALLOWED_ENV PHP_FCGI_MAX_REQUESTS"
ALLOWED_ENV="$ALLOWED_ENV FCGI_WEB_SERVER_ADDRS"
if test x$UID = x0; then
EX="/bin/su -m -c \"$PHPFCGI -q -b $FCGIADDR:$FCGIPORT\" $USERID"
else
EX="$PHPFCGI -b $FCGIADDR:$FCGIPORT"
fi
echo $EX
# copy the allowed environment variables
E=
for i in $ALLOWED_ENV; do
E="$E $i=${!i}"
done
# clean environment and set up a new one
nohup env - $E sh -c "$EX" &> /dev/null &Last edited by viniosity (2007-06-04 05:08:57)
Offline
does your nginx user exist?
I think arch uses 'nobody' for nginx, as well as apache.
My recommendation would be to create a new user for php to use.
groupadd phpx
useradd -g phpx -s /bin/false -d / phpxThe user nobody doesn't work well with su -c (password update required).
Do the above steps, and then change the user in your fcgi launch script to phpx.
USERID=phpx"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍
Offline
oh. you have a typo too..not sure if that is just a paste error in your script or not.
LLOWED_ENV="$ALLOWED_ENV PHP_FCGI_CHILDREN"That should be
ALLOWED_ENV="$ALLOWED_ENV PHP_FCGI_CHILDREN""Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍
Offline
oh. another fyi.
I think i remember having to add some data to one of the variables.
I added near the top of my script.
FCGI_WEB_SERVER_ADDRS="127.0.0.1,10.128.128.50"Where those are the ips of webservers that fcgi-php allows to connect to it. The 10. address was the address of my webserver. Not sure if it is needed anymore..or if it was just something funky that I was doing at the time that required it. Only use it if you find you need to.
"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍
Offline
I tried both adding the php group and user as well as adding a line that says:
FCGI_WEB_SERVER_ADDRS="127.0.0.1"but neither worked. As soon as I launch the command as root I get:
/bin/su -m -c "/usr/bin/php-cgi -q -b 127.0.0.1:8888" phpxthen, when I type something else (even just ls), I get:
[1]+ Exit 1 nohup env - $E sh -c "$EX" >&/dev/nullCould it be a missing package? I do have php and php-cgi installed.. Else maybe I'm launching it incorrectly? From the /home/httpd/phpmyadmin/ directory I'm typing:
. fastcgi_scriptWhere I've previously run chmod +x fastcgi_script I've even tried chowning the file to nobody:phpx
-rwxr-xr-x 1 nobody phpx 1079 2007-06-04 16:20 fastcgi_scriptPS: yeah, the ALLOWED thing was a cut/paste typo.. ![]()
thanks cactus!
Offline
wait. you have php and php-cgi installed?
They were both merged into one package a while back.. you should try removing both packages, and installing just the most recent php package.
Also, try starting php *yourself* from the command line. It should launch with your properties, and give you *some* kind of output.
/usr/bin/php-cgi -b 127.0.0.1:8888See if anything shows up on the display. If it just returns to the next line (and looks like it is working), then login in another terminal, and do a 'netstat -nlt | grep 8888' and see if it lists that port as listening.
If that works, then we can go from there. If it doesn't work..then something is borked with php.
"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍
Offline
When I run it as myself, the output is
/usr/bin/php-cgi -b 127.0.0.1:8888No need to switch to another terminal, but netstat -nlt | grep 8888 outputs:
tcp 0 0 127.0.0.1:8888 0.0.0.0:* LISTENand ps aux | grep php outputs (truncated):
vince 5014 0.0 0.8 13260 4556 pts/1 S 16:53 0:00 /usr/bin/php-cg
vince 5015 0.0 0.3 13260 2040 pts/1 S 16:53 0:00 /usr/bin/php-cg
vince 5016 0.0 0.3 13260 2040 pts/1 S 16:53 0:00 /usr/bin/php-cg
vince 5017 0.0 0.3 13260 2040 pts/1 S 16:53 0:00 /usr/bin/php-cg
vince 5018 0.0 0.3 13260 2040 pts/1 S 16:53 0:00 /usr/bin/php-cg
vince 5019 0.0 0.3 13260 2040 pts/1 S 16:53 0:00 /usr/bin/php-cg
vince 5038 0.0 0.1 3084 784 pts/1 S+ 16:55 0:00 grep phpInterestingly, going to localhost/index.php gives me an error that says "No input file specified." Yesterday I think I was getting a bad gateway error. Progress? I was assuming that nginx can't work this way because the php stuff is running under my user.
Here's the (I believe..) relevant part of my nginx.conf
server {
listen 80;
server_name localhost.localdomain;
location / {
root /home/httpd/html/phpmyadmin;
index index.html index.htm index.php;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:8888;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/httpd/phpmyadmin$f
astcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
}
}thanks!
Offline
looks like
fastcgi_param SCRIPT_FILENAME /home/httpd/phpmyadmin$f
astcgi_script_name;should be
fastcgi_param SCRIPT_FILENAME /home/httpd/html/phpmyadmin$f
astcgi_script_name;based on your doc root directory you defined earlier.
for more info on configuring nginx, check out the nginx wiki.
http://wiki.codemongers.com/Nginx
Good stuff in there.
As to your problem with launching the fastcgi with the script, I just noticed you said you were launching it with `. fastcgi_spawn`. The '.' sources the script. Instead, make that script executable and launch it. You must launch the file as root to be able to get su to work without prompting you for a password.
"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍
Offline
Ug, that directory mistake was stupid.. thanks for catching it. I'm adapting a working script that I use for my ubuntu server and mistakes do happen..
Slight update.. when I change the user in the fastcgi script to root (instead of phpx or ngninx), it works when I launch it.
Likewise, just to test, I changed nginx to run as root (this is a local deployment anyway..) but I still got the no file specified error. I'll go through the wiki and see what I can dig up.
Thanks
Offline
Did you solve that problem? Cause I've got the same ![]()
Offline
Pages: 1