You are not logged in.

#1 2007-12-09 23:20:23

signalb
Member
Registered: 2007-12-09
Posts: 2

Archlinux Nginx PHP with fastcgi help

Hello,
I decided to swith my server from Ubuntu to Arch a few days ago due in part from the great reviews of Arch.
However I have not been able to get php working yet. sad

what I did first was to install Nginx via pacman
no problems with that and works fine
next I installed php and xcache via pacman
running php -v from my terminal I get:

PHP 5.2.5 with Suhosin-Patch 0.9.6.2 (cgi-fcgi) (built: Nov 13 2007 20:03:00)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
    with XCache v1.2.1, Copyright (c) 2005-2007, by mOo

Next I installed fastcgi from the lighttpd source by downloading the tar, unpacking and running ./configure and make.
moved spawn-fcgi by doing:
cp src/spawn-fcgi /usr/bin/spawn-fcgi
created the file usr/bin/php-fastcgi and added the following:

#!/bin/sh
/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -f /usr/bin/php-cgi

next the file /etc/rc.d/init-fastcgi chmod'ed to 755 and added:

#!/bin/bash
PHP_SCRIPT=/usr/bin/php-fastcgi
RETVAL=0
case "$1" in
    start)
      $PHP_SCRIPT
      RETVAL=$?
  ;;
    stop)
      killall -9 php
      RETVAL=$?
  ;;
    restart)
      killall -9 php
      $PHP_SCRIPT
      RETVAL=$?
  ;;
    *)
      echo "Usage: php-fastcgi {start|stop|restart}"
      exit 1
  ;;
esac      
exit $RETVAL

and lastly changed /etc/nginx/conf/nginx.conf to include:

location ~ \.php$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            include        conf/fastcgi_params;
             fastcgi_param  SCRIPT_FILENAME  /etc/nginx/html$fastcgi_script_name;
       }

After rebooting here's what I get now:

When I run /etc/rc.d/init-fastcgi start
I get the output:

spawn-fcgi.c.186: child spawned successfully: PID: 27970

When I run php -v I get:

/dev/zero: No space left on device
Failed creating file mappping
PHP 5.2.5 with Suhosin-Patch 0.9.6.2 (cgi-fcgi) (built: Nov 13 2007 20:03:00)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
    with XCache v1.2.1, Copyright (c) 2005-2007, by mOo

When I go to my domain nginx serves up html but going to a php page with phpinfo() I get:
No input file specified.

I'm really not sure what's going on here and any help will be greatly appreciated I really want to stay with Arch but also need it to work.

Last edited by signalb (2007-12-09 23:51:24)

Offline

#2 2007-12-10 02:27:09

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: Archlinux Nginx PHP with fastcgi help

Not sure what is happening with your php config.
Try shutting down the service (/etc/rc.d/init-fastcgi stop), and starting php-fastcgi manually from the command line.

Also, there isn't really a need to use lighttpd's start script. Php can do it itself, you just need a bash script to launch it..

example link: http://blog.kovyrin.net/2006/05/30/ngin … cgi-howto/

You might try setting the php.ini
cgi.fix_pathinfo=1

Not sure if it is needed, as I don't do a *whole* lot with php anymore.
I love nginx though. big_smile


"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

#3 2007-12-10 13:59:47

VikM
Member
Registered: 2007-11-10
Posts: 50

Re: Archlinux Nginx PHP with fastcgi help

Is indeed /etc/nginx/html the path to your site root directory?

Offline

#4 2007-12-10 19:13:06

signalb
Member
Registered: 2007-12-09
Posts: 2

Re: Archlinux Nginx PHP with fastcgi help

It is, I don't know what's going on. I know other people had trouble with using relative versus absolute paths but I checked and rechecked my path info and my php.ini so not sure what the deal is.

Offline

#5 2007-12-10 22:15:31

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: Archlinux Nginx PHP with fastcgi help

maybe post the output of php -i somewhere in a nopaste site and link to it here...
could be some weird issue with the php.ini


"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

#6 2007-12-11 09:04:30

VikM
Member
Registered: 2007-11-10
Posts: 50

Re: Archlinux Nginx PHP with fastcgi help

Does it works with XCache disabled?
Maybe this helps: http://forum.lighttpd.net/topic/7188

Offline

#7 2008-02-28 17:12:10

chosig
Member
From: Överkalix, Sweden
Registered: 2008-02-28
Posts: 3

Re: Archlinux Nginx PHP with fastcgi help

signalb wrote:

No input file specified.

that you get because fastcgi_param SCRIPT_FILENAME doesn't point to where you have your PHP files.

fastcgi_param  SCRIPT_FILENAME  /etc/nginx/html$fastcgi_script_name;

you have the test file at /etc/nginx/html/testfile.php ?

nginx installs to /usr/local/nginx/html by default

XCache Doc's wrote:

xcache.mmap_path string
for *nix, xcache.mmap_path is a file path, not directory. for win32, xcache.mmap_path is anonymous map name, not a file path. Use something like "/tmp/xcache" if you want to turn on ReadonlyProtection, 2 group of php won't share the same /tmp/xcache.

xcache.mmap_path is set to /dev/zero by default, perhaps that's the problem.

Offline

#8 2008-12-17 17:30:12

lessless
Member
Registered: 2008-12-16
Posts: 4

Re: Archlinux Nginx PHP with fastcgi help

so, did something worked out ?

Offline

#9 2009-03-24 21:55:22

jacko
Member
Registered: 2007-11-23
Posts: 840

Re: Archlinux Nginx PHP with fastcgi help

I had a hell of a time too, then I got smart and asked in #nginx on irc.

you need to add index.php to the / location{}

location / {
root           /path/root;
index         index  index.html index.htm index.php;
}

I got php/fcgi + nginx + mysql + wordpress up and runnning with great results. This fix will only help if you are getting errors in the logs about index.php not existing.

I am not sure, but I think the problem lies in the fact that fastcgi_index doesn't work as it once did or is not the correct way to use it. I found another blog that had relevant information suggesting to add index.php to / loaction {} and all worked out.

Last edited by jacko (2009-03-24 21:58:59)

Offline

#10 2009-03-25 09:29:53

Dieter@be
Forum Fellow
From: Belgium
Registered: 2006-11-05
Posts: 2,000
Website

Re: Archlinux Nginx PHP with fastcgi help

fwiw, there are various fcgi (fastcgi) packages in AUR.


< Daenyth> and he works prolifically
4 8 15 16 23 42

Offline

#11 2009-04-20 07:41:21

MindTooth
Member
From: Norway
Registered: 2008-11-11
Posts: 331

Re: Archlinux Nginx PHP with fastcgi help

When I use a init script, can I use the user nginx and group nginx? This is so I can copy some premade script available throughout the internet.

Birger smile

Offline

Board footer

Powered by FluxBB