php 5.3.6 + lighttpd 1.4.28 + fastcgi/php-fpm + FreeBSD 8.2-RELEASE

Hi all,

I have a dedicated server setup with lighttpd and able to serve static files. I have PHP installed with php-fpm. I have edited the .conf files to listen to a UNIX socket. When I request a .php file, the server returns a 403 forbidden error. It must be a fastcgi/php-fpm problem since lighttpd is able to serve static files. Below is a portion of the output from [CMD=]sockstat -u -4[/CMD]. I have set file permissions correctly as well.

Code:
www      lighttpd   1231  4  tcp6   *:80                  *:*
www      lighttpd   1231  5  tcp4   *:80                  *:*
www      lighttpd   1231  8  tcp4   173.193.223.xxx:80    74.12.36.xxx:61336
www      php-fpm    1161  0  stream /tmp/php-fpm.sock
www      php-fpm    1160  0  stream /tmp/php-fpm.sock
www      php-fpm    1159  0  stream /tmp/php-fpm.sock
www      php-fpm    1158  0  stream /tmp/php-fpm.sock
www      php-fpm    1157  0  stream /tmp/php-fpm.sock
www      php-fpm    1156  0  stream /tmp/php-fpm.sock
www      php-fpm    1155  0  stream /tmp/php-fpm.sock
www      php-fpm    1154  0  stream /tmp/php-fpm.sock
www      php-fpm    1153  0  stream /tmp/php-fpm.sock
www      php-fpm    1152  0  stream /tmp/php-fpm.sock
www      php-fpm    1151  0  stream /tmp/php-fpm.sock
www      php-fpm    1150  0  stream /tmp/php-fpm.sock
www      php-fpm    1149  0  stream /tmp/php-fpm.sock
www      php-fpm    1148  0  stream /tmp/php-fpm.sock
www      php-fpm    1147  0  stream /tmp/php-fpm.sock
www      php-fpm    1146  0  stream /tmp/php-fpm.sock
www      php-fpm    1145  0  stream /tmp/php-fpm.sock
www      php-fpm    1144  0  stream /tmp/php-fpm.sock
www      php-fpm    1143  0  stream /tmp/php-fpm.sock
www      php-fpm    1142  0  stream /tmp/php-fpm.sock
root     php-fpm    1134  4  stream -> ??
root     php-fpm    1134  5  stream -> ??
root     php-fpm    1134  6  stream /tmp/php-fpm.sock

This is a portion of the configuration files. I kept the same filename even though I'm not using spawn-cgi. The modules are enabled accordingly. Followed the documentations from the lighttpd website and other sources on the internet.

fastcgi.conf
Code:
fastcgi.server = ( ".php" =>
  (( "socket" => "/tmp/php-fpm.sock",
      "bin-path" => "/usr/local/bin/php-cgi",
      "bin-environment" => (

        "PHP_FCGI_CHILDREN" => "16",
        "PHP_FCGI_MAX_REQUESTS" => "10000"
      ),
      "max-procs" => 5,
      "bin-copy-environment" => ( "PATH", "SHELL", "USER" ),
      "broken-scriptfilename" => "enable"
  ))
)

php-fpm.conf
Code:
; The address on which to accept FastCGI requests.
; Valid syntaxes are:
;   'ip.add.re.ss:port'    - to listen on a TCP socket to a specific address on
;                            a specific port;
;   'port'                 - to listen on a TCP socket to all addresses on a
;                            specific port;
;   '/path/to/UNIX/socket' - to listen on a UNIX socket.
; Note: This value is mandatory.
listen = /tmp/php-fpm.sock

Anyone see what I am doing wrong? Thanks in advance. If you require full configuration files or more information, I am more than happy to provide it. Countless hours and energy drinks were not able to help me.

-Einthusan
 
No one on this forum can help me? Is it that no one knows the solution or is it because I am a first time poster?
 
The combination of FreeBSD + lighttpd + php-fm may be quite rare. I see no FreeBSD-specific problem here, so you may try a lighttpd forum where users on other platforms may boost the numbers.
 
Sorry for the late reply.

Code:
hostname="host396470"
defaultrouter="173.193.223.129"
ifconfig_em0="inet 10.32.133.66 netmask 255.255.255.0 media 1000baseTX mediaopt full-duplex"
ifconfig_em1="inet 173.193.223.179 netmask 255.255.255.192 media 1000baseTX mediaopt full-duplex"
static_routes="service"
route_service="-net 10.0.0.0/8 10.32.133.1"
sendmail_enable="YES"
sshd_enable="YES"
ntpdate_enable="YES"
ntpdate_flags="time.service.softlayer.com"
syslogd_enable="YES"
syslogd_flags="-ss"
kern_securelevel_enable="NO"
nfs_reserved_port_only="YES"
clear_tmp_enable="YES"
ntpd_enable="YES"
lighttpd_enable="YES"
mysql_enable="YES"
php_fpm_enable="YES"

I have attached the php-fpm configuration as a .txt file.
Thanks for your help! I owe you for at least trying to help me.
 

Attachments

  • php-fpm.txt
    12.4 KB · Views: 447
In your configuration, the bin-path is pointing to /usr/local/bin/php-cgi.

I am not sure if it is correct or not, because my server combination is similar to yours, but I am using apache. Since you are using fastcgi, you should not require php-cgi. In my server, I only install php-cli, php-fpm. Maybe it is a clue for you.
 
If it was a php-fpm problem I think lighttpd should return a Internal Server Error 500 and not 403 forbidden.

You can show us your complete vHost-Configuration? Maybe you are using some vHost-Setting that gives php-files another root-path?
 
Hi,

Thanks for the reply. I thought php-cgi was a replacement for fastcgi and so i did not install fastcgi. The only reason why I took this path is because somewhere I read that php-cgi was better than fastcgi. Please do correct me if this is incorrect. I think I am just going to stick with fastcgi.

By the way, how do I show the entire vhost file, I believe what I had put up was the entire file. Maybe your asking about the default settings which FreeBSD keeps as a separate file?

I will install fastcgi and see how it goes from there. Thanks so much for your help.
 
Back
Top