1

I tried in many ways to install php5-fpm in om Debian squeeze, but couldn't. I was wondering if I have to upgrade php5.3.3 to higher version because it doesn't seem to work on lower than php5.4

I have no idea if Php5-fpm can be installed on Debian squeeze php5.3 base or not??

I used this commend line to do so, but returned an error:

apt-get install php5-fpm

any help is appreciated!

  • php5-fpm is not available on squeeze, but you can (probably) backport it to squeeze yourself. Check out unix.stackexchange.com/q/112157/4671 If you want to go this route, feel free to ask for more details if necessary. – Faheem Mitha Jun 27 '14 at 14:46
  • dotdeb.org has backported version of php5-fpm for debian squeeze – kiba Mar 18 '15 at 7:30
3

PHP5-FPM is available as package on debian from Wheezy: Debian package list. There are also no backports available so you will need to update to Wheezy if you want to keep using the package manager.

It's support from PHP 5.3.3 so that part is ok, but won't help you out at this moment.

Added alternative way: For using PHP-CGI you can do the following:

apt-get install php5-cgi

Create an init file and set it up to start with system boot. Example below will launch 10 workers and listens o

#!/bin/bash
### BEGIN INIT INFO
# Provides:          php-fcgi
# Required-Start:    $nginx
# Required-Stop:     $nginx
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts php over fcgi
# Description:       starts php over fcgi
### END INIT INFO

(( EUID )) && echo .You need to have root priviliges.. && exit 1
BIND=127.0.0.1:9000
USER=www-data
PHP_FCGI_CHILDREN=10
PHP_FCGI_MAX_REQUESTS=10000

PHP_CGI=/usr/bin/php-cgi
PHP_CGI_NAME=`basename $PHP_CGI`
PHP_CGI_ARGS="- USER=$USER PATH=/usr/bin PHP_FCGI_CHILDREN=$PHP_FCGI_CHILDREN PHP_FCGI_MAX_REQUESTS=$PHP_FCGI_MAX_REQUESTS $PHP_CGI -b $BIND"
RETVAL=0

start() {
      echo -n "Starting PHP FastCGI: "
      start-stop-daemon --quiet --start --background --chuid "$USER" --exec /usr/bin/env -- $PHP_CGI_ARGS
      RETVAL=$?
      echo "$PHP_CGI_NAME."
}
stop() {
      echo -n "Stopping PHP FastCGI: "
      killall -q -w -u $USER $PHP_CGI
      RETVAL=$?
      echo "$PHP_CGI_NAME."
}

case "$1" in
    start)
      start
  ;;
    stop)
      stop
  ;;
    restart)
      stop
      start
  ;;
    *)
      echo "Usage: php-fastcgi {start|stop|restart}"
      exit 1
  ;;
esac
exit $RETVAL

in NGINX add this in the config part for your PHP part to redirect all requests to localhost on port 9000.

location ~ \.php$ {
     # Filter out arbitrary code execution
    location       ~ \..*/.*\.php$ {return 404;}

    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include        fastcgi_params;
    fastcgi_pass   127.0.0.1:9000;
}

I got a file in '/etc/nginx/fastcgi_params' with all the other fastcgi params. This is the content but its free for change.

fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;

fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;
fastcgi_param  HTTPS              $https if_not_empty;

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param  REDIRECT_STATUS    200;
  • The issue is that I have an application run on only php5.3 so I can change the distribution if necessary. BTW, I don't see any support for php5.3.3 at Debian Wheezy. it starts from php5.4... – Digital site Jun 27 '14 at 14:10
  • I think you mean to use Debian Wheezy and downgrade php5.4 to php5.3, is that what you meant? – Digital site Jun 27 '14 at 14:14
  • Yes, Wheezy does 5.4, but the question to your question if it would work with 5.3.3 is yes. If you really want FPM you would need to compile it. What are you trying to accomplish? Work with PHP and Nginx? – Bvlent Jun 27 '14 at 14:15
  • yes, you are right. I have an application vbulletin board that run on php5.3.x and want to have Nginx 1.4 or Nginx 1.6 with Php-fpm... do you think that is possible? – Digital site Jun 27 '14 at 14:40
  • 1
    You can have a look at the php5-cgi package. Create a init script and you can run with NGINX. I can share the init script i use and config for NGINX to access the PHP workers if you like. – Bvlent Jun 27 '14 at 14:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.