Difference between pages "Package:PHP" and "Package:Rutorrent"

From Funtoo
(Difference between pages)
Jump to navigation Jump to search
m (add clock info and other stuff)
 
m (fix link to rtorrent configuration setting)
 
Line 1: Line 1:
{{Ebuild
{{Ebuild
|Summary=The PHP language runtime engine: CLI, CGI, FPM/FastCGI, Apache2 and embed SAPIs
|Summary=ruTorrent is a front-end for the popular Bittorrent client rTorrent
|CatPkg=dev-lang/php
|CatPkg=www-apps/rutorrent
|Maintainer=
|Homepage=http://code.google.com/p/rutorrent/
|Homepage=http://php.net/
}}
}}
PHP is a server-side scripting language designed for web development but also used as a general-purpose programming language.
rutorrent is a front end to {{package|net-p2p/rtorrent}} and is designed to look like utorrent =D


== Install ==
{{console|body=###i## emerge www-apps/rutorrent}}
=== Use Flags ===
By default php does not have the cgi, FPM/FastCGI, mysql, mysqli, apache2 use flag turned on.  Many packages are php aware, set the php global use flag so other applications can interact with php.


{{file|name=/usr/portage/make.conf|desc=insert desired use flags|body=
===Prerequisites===
USE="php mysql mysqli apache2 fpm cgi......"
*Install your web server {{package|www-servers/nginx}}, and get {{package|dev-lang/php}} with the fpm use flag running first.  nginx needs to be built with nginx_modules_http_scgi
*you must turn on scgi_pass in the [[Package:Rtorrent#xml_rpc | rtorrent]] config.
*you must be running rtorrent, or rtorrentd.
 
===Configuration===
==== nginx config====
{{file|name=/etc/nginx/sites-available/localhost|lang=|desc=nginx configuration|body=
server {
listen 127.0.0.1:80;
server_name localhost;
access_log /var/log/nginx/localhost.access_log main;
error_log /var/log/nginx/localhost.error_log info;
root /var/www/localhost/htdocs;
index index.php index.cgi index.htm index.html;
autoindex on;
 
        location ~ \.php$ {
                fastcgi_pass 127.0.0.1:9000;
include fastcgi.conf;
                #fastcgi_pass unix:/var/run/php5-fpm.sock;
        }
 
          location /rutorrent {
              include scgi_params;
              scgi_pass localhost:5000;
          }
}
}}
}}


=== Emerge ===
Restart nginx:
<console>###i## emerge php</console>
{{console|body=###i## /etc/init.d/nginx restart}}


== Fpm ==
Point your browser to
Fpm is a php handler.  It is php daemonized.


=== init ===
http://127.0.0.1/rutorrent


To start the php-fpm service:
or
<console>###i## rc-service php-fpm start</console>


To start the php-fpm service at boot:
http://localhost/rutorrent
<console>###i## rc-update add php-fpm</console>


=== Configuration ===
===Troubleshooting===


Php-fpm is controlled by <code>/etc/php/fpm-php*.*/php-fpm.conf</code> and <code>/etc/php/fpm-php*.*/php.ini</code>
====Errors====
If you are able to open the rutorrent web interface but receive errors such as '''Bad response from server: (502 [error,getplugins])''' then edit and change/uncomment the following:


==== tips ====
{{file|name=/etc/php/fpm-php5.5/php-fpm.conf |lang=|desc=|body=
==== Change Php Fpm's User/Group ====
listen.owner = www-data
Making php-fpm workers work as the apache user makes most apache permission configurations work with out a bother.
listen.group = www-data
{{file|name=/etc/php/fpm-php5.6/php-fpm.conf|lang=|desc=make workers run as another user|body=
listen.mode = 0666
;user = nobody
;group = nobody
user = apache
group = apache
}}
}}


==== Limiting Workers ====
The just restart php-fpm:
Limit worker numbers to 20 max.  When your server is behind a reverse proxy it doesn't need many workers.
 
{{file|name=/etc/php/fpm-php5.6/php-fpm.conf|lang=|desc=limit workers|body=
{{console|body=###i## /etc/init.d/php-fpm restart}}
pm.max_children = 20
 
pm.start_servers = 1
====Clock shows the incorrect time====
pm.min_spare_servers = 1
 
pm.max_spare_servers = 19
If rutorrent's clock displays the incorrect time/timezone then it can be changed.  
 
{{file|name=/etc/php/fpm-php5.5/php.ini |lang=|desc=|body=
date.timezone = "Europe/Athens"
}}
}}


==== Date & Time ====
A full list of supported timezones can be found at http://php.net/manual/en/timezones.php
Set the time and date for php web applications.  [http://php.net/manual/en/timezones.php full list of php timezones]
{{file|name=/etc/php/fpm-php5.6/php-fpm.conf|lang=|desc=limit workers|body=
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
;date.timezone =
}}


the same procedures can be done for other php implementations at
==== 502 ====
*/etc/php/cli-php5.6/php.ini
502 Bad Gateway is caused by nginx being started and php-fpm not being started.
*/etc/php/apache2-php5.6/php.ini
*/etc/php/cgi-php5.6/php.ini


=== Media ===
==== Programming ====
{{#widget:YouTube|playlist=PL00694B0DAD604DE6}}


{{PageNeedsUpdates}}
{{EbuildFooter}}
{{EbuildFooter}}

Latest revision as of 21:42, March 10, 2015

Rutorrent

   Tip

We welcome improvements to this page. To edit this page, Create a Funtoo account. Then log in and then click here to edit this page. See our editing guidelines to becoming a wiki-editing pro.

rutorrent is a front end to net-p2p/rtorrent and is designed to look like utorrent =D

root # emerge www-apps/rutorrent

Prerequisites

  • Install your web server www-servers/nginx, and get dev-lang/php with the fpm use flag running first. nginx needs to be built with nginx_modules_http_scgi
  • you must turn on scgi_pass in the rtorrent config.
  • you must be running rtorrent, or rtorrentd.

Configuration

nginx config

   /etc/nginx/sites-available/localhost - nginx configuration
server {
	listen 127.0.0.1:80;
	server_name localhost;
	access_log /var/log/nginx/localhost.access_log main;
	error_log /var/log/nginx/localhost.error_log info;
	root /var/www/localhost/htdocs;
	index index.php index.cgi index.htm index.html;
	autoindex on;

        location ~ \.php$ {
                fastcgi_pass 127.0.0.1:9000;
		include fastcgi.conf;
                #fastcgi_pass unix:/var/run/php5-fpm.sock;
        }

           location /rutorrent {
               include scgi_params;
               scgi_pass localhost:5000;
           }
}

Restart nginx:

root # /etc/init.d/nginx restart

Point your browser to

http://127.0.0.1/rutorrent

or

http://localhost/rutorrent

Troubleshooting

Errors

If you are able to open the rutorrent web interface but receive errors such as Bad response from server: (502 [error,getplugins]) then edit and change/uncomment the following:

   /etc/php/fpm-php5.5/php-fpm.conf
listen.owner = www-data
listen.group = www-data
listen.mode = 0666

The just restart php-fpm:

root # /etc/init.d/php-fpm restart

Clock shows the incorrect time

If rutorrent's clock displays the incorrect time/timezone then it can be changed.

   /etc/php/fpm-php5.5/php.ini
date.timezone = "Europe/Athens"

A full list of supported timezones can be found at http://php.net/manual/en/timezones.php

502

502 Bad Gateway is caused by nginx being started and php-fpm not being started.